Property Sensor Changed: mode

mode
  • gets/sets the Evaluation Type
     
  • Property Sensor name: Evaluation Type

Type: 
  • integer

Values:

  • 1 = Equal
  • 2 = Not Equal
  • 3 = Interval
  • 4 = Changed
Property Sensor:
  • Property being evaluated has to be on the same game object as the sensor
     
  • Property Sensor is triggered when the Evaluation Type is met.
     
  • One positive pulse is immediately followed by a negative pulse.
Sample Code


################  Get the Evaluation Type.

# import bge module
import bge

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

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

sen = cont.sensors["Die"]

# get the evaluation type
type = sen.mode
 
Sample Code


################  Set the Evaluation Type.
 
# import bge module
import bge

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

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

sen = cont.sensors["Die"]

# Set the Evaluation type to Changed
sen.mode = 4