Delay Sensor: duration

duration
  • gets/sets the number of frames the sensor waits after sending a positive pulse before it sends a negative pulse.

Type: 
  • integer

Range:

  • 0 to 5000
Delay Sensor:
  • The Delay Sensor delays sending a pulse to the controller.
Sample Code


################  Get duration

# import bge module
import bge

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

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

sen = cont.sensors["Recharge"]

# get number of frames the sensor waits before sending a negative pulse
dur = sen.duration 
 
Sample Code


################  Set duration

# import bge module
import bge

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

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

sen = cont.sensors["Recharge"]

# set number of frames the sensor waits before sending a negative pulse
sen.duration = 5