Blender 3D game engine: SCA_DelaySensor
Methods:
getDelay setDelay
getDuration setDuration
getRepeat setRepeat
Variables:
---------- ----------
Constants:
---------- ----------
Inherited
Methods:
getExecutePriority isPositive
getFrequency isTriggered
getInvert reset
getLevel setExecutePriority
getName setFrequency
getOwner setInvert
getUseNegPulseMode setLevel
getUsePosPulseMode setUseNegPulseMode
isA setUsePosPulseMode



Instance Methods

getDelay

getDelay()

Returns the number of frames the sensor waits before using a positive pulse to trigger the sensor.

Return Type:  integer

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the delay sensor named sensor
sen = controller.getSensor("sensor")

# get the delay
delay = sen.getDelay()

getDuration

getDuration()

Returns the number of frames the sensor waits after using a positive pulse to trigger the sensor before it uses a negative pulse to deactive the sensor.

Return type:  integer

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the delay sensor named sensor
sen = controller.getSensor("sensor")

# get the duration
dur = sen.getDuration()

getRepeat

getRepeat()

Returns the state of the Repeat (REP) toggle button.  

Return Type:  integer

1 = repeat the cycle (delay/duration) over and over.
0 = run cycle once.  Don't repeat.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the delay sensor named sensor
sen = controller.getSensor("sensor")

# repeat the delay/duration cycle?
cycle = sen.getRepeat()

setDelay

setDelay(delay)

Sets the number of frames the sensor waits before using a positive pulse to trigger the sensor.

delay:
Type:  integer

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the delay sensor named sensor
sen = controller.getSensor("sensor")

# set the delay to 10 frames
sen.getDelay(10)

setDuration

setDuration(duration)

Sets the number of frames the sensor waits after using a positive pulse to trigger the sensor before it uses a negative pulse to deactive the sensor.

duration:
Type:  integer

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the delay sensor named sensor
sen = controller.getSensor("sensor")

# wait 20 frames before deactivating the sensor
sen.setDuration(20)

setRepeat

setRepeat(repeat)

Sets the state of the Repeat (REP) toggle button.  

repeat:
Type:  integer

   1 = repeat the cycle (delay/duration) over and over.
   0 = run cycle once.  Don't repeat.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the delay sensor named sensor
sen = controller.getSensor("sensor")

# repeat the delay/duration cycle
sen.setRepeat(1)



Instance Methods: Inherited

getFrequency

getFrequency()

Returns the delay between repeated pulses.  

Return Type:  Integer
0 = no delay.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# get sensor Frequency
pulseFreq = sen.getFrequency()

getInvert

getInvert()

Returns if sensor is set to activate on negative events.

Return Type:  Bool

True = sensor activated on negative events
False = sensor activated on positive events

Note:
It is supposed to return a bool.
1 = True
0 = False

It doesn't.  Instead it returns
1 = True
2  = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# trigger on negative pulse?
trigger = sen.getInvert()

getLevel

getLevel()

The Level button is a part of the State System.

Returns whether or not the level (Lvl) button is active.

Level button activated:
Deactivated mouse sensor is reactivated:
Checks to see if a mouse button is being pressed.
If it is, it sends a pulse to the controller.

Level button not activated:
Deactivated mouse sensor is reactivated:
Doesn't check to see if a mouse button is being pressed.
Doesn't send pulse to the controller.

Return Type:  Bool

1 = True = Level button active.
2 = False = Level button inactive.
Note:
Only works reliably when the sensor is connected to a single state.

Note:
It is supposed to return a bool.
1 = True
0 = False

It doesn't.  Instead it returns
1 = True
2  = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# send pulse when activated by State System?
sendPulse = sen.getLevel()

getUseNegPulseMode

getUseNegPulseMode()

Returns if sensor is set to use negative pulse.

Return Type:  Bool

1 = True = Use negative pulse
2 = False = Don't use negative pulse

Note:
It is supposed to return a bool.
1 = True
0 = False

It doesn't.  Instead it returns
1 = True
2  = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# trigger on negative pulse?
trigger = sen.getUseNegPulseMode()

getUsePosPulseMode

setBlendtime(blendtime)

Returns if sensor is set to use positive pulse.

Return Type:  Bool

1 = True = Use positive pulse
2 = False = Don't use positive pulse

Note:
It is supposed to return a bool.
1 = True
0 = False

It doesn't.  Instead it returns
1 = True
2  = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# trigger on positive pulse?
trigger = sen.getUsePosPulseMode()

isPositive

isPositive()

Returns True when sensor is activated.  False when it is deactivated.

Return Type:   Bool

1 = True = sensor activated
0 = False = sensor deactivated

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# sensor being activated?  Deactivated?
activated = sen.isPositive()

isTriggered

isTriggered()

Returns if sensor has triggered the controller

Return Type:   Bool

1 = True = sensor triggered controller
0 = False = sensor hasn't triggered controller

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# sensor triggered controller?
trigger = sen.isTriggered()

reset

reset()

Resets the sensor to it's initial state.  (ie. just activated)

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# reset the sensor
sen.reset()

setFrequency

setFrequency(freq)

Sets the delay between repeated pulses.  

freq: 
Type is integer.

0 = no delay.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# set Frequency to no delay
sen.setFrequency(0)

setInvert

setInvert(inv)

Sets if  the sensor is to activate on negative events.

inv: 
Type: Bool.

  1 = True = activate on negative events
  0 = False = activate on positive events

Note:
True, False and 1, 0 work as expected

But
getInvert()
2 = False

setInvert(2)
sets it to True

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# set to activate on negative events
sen.setInvert(True)

setLevel

setLevel(activate)

The Level button is a part of the State System.

Sets whether or not the level (Lvl) button is active.

Level button activated:
Deactivated mouse sensor is reactivated:
Checks to see if a mouse button is being pressed.
If it is, it sends a pulse to the controller.

Level button not activated:
Deactivated mouse sensor is reactivated:
Doesn't check to see if a mouse button is being pressed.
Doesn't send pulse to the controller.


activate:
Type:  Bool

   1 or True = Level button active.
   0 or False = Level button inactive.

Note:
Only works reliably when the sensor is connected to a single state.

Note:
True, False and 1, 0 work as expected

But
getLevel()
2 = False

setLevel(2)
2 sets it to True

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named sensor
sen = controller.getSensor("sensor")

# set level detector to True
sen.setLevel(True)

setUseNegPulseMode

setUseNegPulseMode(pulse)

Sets the sensor to use negative pulse mode.

pulse: 
 Type  =  Bool.

1 = True = Use negative pulse mode
0 = False = Use positive pulse mode

Note:
True, False and 1, 0 work as expected

But
getUseNegPulseMode()
2 = False

setUseNegPulseMode(2)
2 sets it to True

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named MouseOver
sen = controller.getSensor("sensor")

# set to use on negative pulse
sen.setUseNegPulseMode(True)

setUsePosPulseMode

setUsePosPulseMode(pulse)

Sets the sensor to use positive pulse mode.

pulse: 
 Type  =  Bool.

1 = True = Use positive pulse mode
0 = False = Use negative pulse mode

Note:
True, False and 1, 0 work as expected

But
getUsePosPulseMode()
2 = False

setUsePosPulseMode(2)
2 sets it to True

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get sensor named MouseOver
sen = controller.getSensor("sensor")

# set to use on positive pulse
sen.setUsePosPulseMode(True)



Instance Methods: Inherited

getExecutePriority

getExecutePriority()

Gets the execute priority of the logic brick

Return Type:  integer

Doesn't work:
Crashes Blender

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# get brick priority
priority = act.getExecutePriority()

getOwner

getOwner()

Gets the game object that owns the logic brick.

Return Type:  KX_GameObject

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# get brick owner
owner = act.getOwner()

setExecutePriority

setExecutePriority(priority)

Sets the execution priority of the logic brick.

priority:
   Type:  integer
0 is first
1 is second
etc.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# set brick priority to be first
act.setExecutePriority(0)





isA

isA(Type)

Checks the Object type.
(KX_GameObject, SCA_ILogicBrick, KX_Scene, etc.)

Type:  String

Return Type:  Bool
1 = True
0 = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the object controller attached to
owner = controller.getOwner()

# is owner a GameObject?
gameObject = owner.isA("KX_GameObject")





getName

getName()

Returns the name of actuator

Return Type:  string

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get a list of the attached actuators 
actList = controller.getActuators()

# loop through the list of actuators
for act in actList:

# look for an actuator named "RocketMotion"
if act.getName() == "RocketMotion":

# use it
GameLogic.addActiveActuator(act, True)

# Done.  Break out of loop
break


Blender 3D
Game Engine
Rapid prototyping for 3D games. Test realtime 3D gameplay without having to compile the game code. 3D game models automatically added.  GLSL shaders. Normal Mapping and Parallax Mapping. All OpenGL Lighting modes. This includes transparencies, animated and reflection mapped textures. Multiple textures and materials. UV mapping. Per-pixel lighting and dynamic lighting.  Uses Bullet Physics. Soft body dynamics. Rigid body dynamics. Collision detection and dynamics simulation. Collision bounds of all types. Car physics engine with full support for vehicle dynamics. (Spring reactions, stiffness, damping, tire friction etc.).