Sensor Logic Brick: invert

invert
  • gets/sets if the output of the sensor is inverted.

Type: 
  • boolean

Values:

  • 1 = True = sensor output is inverted
     
  • 0 = False = sensor output isn't inverted
Sensor Logic Brick: Invert
  • Inverts (reverses) the output of the triggers. 
     
  • A positive trigger event sends a negative pulse.
     
  • A negative trigger event sends a positive pulse.
Sample Code


################  get the Invert status

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Sensor_1

sen = cont.sensors["Sensor_1"]

# get the invert status
status = sen.invert
 
Sample Code


################  set the invert status

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Sensor_1

sen = cont.sensors["Sensor_1"]

# set the sensor to invert the output
sen.invert = True