Near Sensor: propName

propName
  • gets/sets the name of the property that the near sensor looks for
     
  • Leave blank for it to react to all
     
  • Near Sensor name: Property

Type: 
  • string
Near Sensor:
  • Game object being detected must have Actor enabled.
Properties menu >> Physics button >> Physics Type >> Actor checkbox
  • Near Sensor is triggered when the first (and only the first) game object is detected.
  • Near Sensor is reset when all game objects are no longer detected.
  • Triggered:  One positive pulse is sent to the connected controller(s).
  • Reset:  One negative pulse is sent to the connected controller(s).
Sample Code


################  Get the name of the property that the near sensor looks for
  
# import bge module
import bge

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

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

sen = cont.sensors["Alert"]

# get the name of the property
name = sen.propName
 
Sample Code


################  Set the name of the property that the near sensor looks for.

# import bge module
import bge

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

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

sen = cont.sensors["Alert"]

# Set the name of the property
# property name is Blue_Team
sen.propName = "Blue_Team"