Module GameTypes :: Class SCA_ISensor
[hide private]
[frames] | no frames]

Class SCA_ISensor

source code

PyObjectPlus --+        
               |        
          CValue --+    
                   |    
     SCA_ILogicBrick --+
                       |
                      SCA_ISensor
Known Subclasses:
SCA_MouseSensor, KX_TouchSensor, KX_NetworkMessageSensor, KX_RaySensor, SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, SCA_PropertySensor, SCA_RandomSensor

Base class for all sensor logic bricks.

Instance Methods [hide private]
 
reset()
Reset sensor internal state, effect depends on the type of sensor and settings.
source code
    Deprecated
 
isPositive()
True if this sensor brick is in a positive state.
source code
 
isTriggered()
True if this sensor brick has triggered the current controller.
source code
 
getUsePosPulseMode()
True if the sensor is in positive pulse mode.
source code
 
setUsePosPulseMode(pulse)
Sets positive pulse mode.
source code
integer
getFrequency()
The frequency for pulse mode sensors.
source code
 
setFrequency(freq)
Sets the frequency for pulse mode sensors.
source code
 
getUseNegPulseMode()
True if the sensor is in negative pulse mode.
source code
 
setUseNegPulseMode(pulse)
Sets negative pulse mode.
source code
 
getInvert()
True if this sensor activates on negative events.
source code
 
setInvert(invert)
Sets if this sensor activates on positive or negative events.
source code
boolean
getLevel()
Returns whether this sensor is a level detector or a edge detector.
source code
 
setLevel(level)
Set whether to detect level or edge transition when entering a state.
source code
    Inherited from SCA_ILogicBrick
integer
getExecutePriority()
Gets the execution priority of this logic brick.
source code
KX_GameObject
getOwner()
Gets the game object associated with this logic brick.
source code
 
setExecutePriority(priority)
Sets the priority of this logic brick.
source code
    Inherited from CValue
string
getName()
Returns the name of the CValue.
source code
    Inherited from PyObjectPlus
bool
isA(game_type)
Check if this is a type or a subtype game_type.
source code
Instance Variables [hide private]
int frequency
The frequency for pulse mode sensors.
boolean invert
Flag to set if this sensor activates on positive or negative events.
boolean level
Option whether to detect level or edge transition when entering a state.
boolean positive
True if this sensor brick is in a positive state.
boolean tap
When enabled only sensors that are just activated will send a positive event, after this they will be detected as negative by the controllers.
boolean triggered
True if this sensor brick is in a positive state.
boolean useNegPulseMode
Flag to turn negative pulse mode on and off.
boolean usePosPulseMode
Flag to turn positive pulse mode on and off.
    Inherited from SCA_ILogicBrick
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
string name
The name of this CValue derived object (read-only).
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read-only).
    Inherited from PyObjectPlus
bool invalid
Test if the object has been freed by the game engine and is no longer valid.
Method Details [hide private]

reset()

source code 

Reset sensor internal state, effect depends on the type of sensor and settings.

The sensor is put in its initial state as if it was just activated.

isPositive()

source code 
True if this sensor brick is in a positive state.

Deprecated: use positive

isTriggered()

source code 
True if this sensor brick has triggered the current controller.

Deprecated: use triggered

getUsePosPulseMode()

source code 
True if the sensor is in positive pulse mode.

Deprecated: use usePosPulseMode

setUsePosPulseMode(pulse)

source code 
Sets positive pulse mode.
Parameters:
  • pulse (boolean) - If True, will activate positive pulse mode for this sensor.

Deprecated: use usePosPulseMode

getFrequency()

source code 
The frequency for pulse mode sensors.
Returns: integer
the pulse frequency in 1/50 sec.

Deprecated: use frequency

setFrequency(freq)

source code 
Sets the frequency for pulse mode sensors.
Returns:
the pulse frequency in 1/50 sec.

Deprecated: use frequency

getUseNegPulseMode()

source code 
True if the sensor is in negative pulse mode.

Deprecated: use useNegPulseMode

setUseNegPulseMode(pulse)

source code 
Sets negative pulse mode.
Parameters:
  • pulse (boolean) - If True, will activate negative pulse mode for this sensor.

Deprecated: use useNegPulseMode

getInvert()

source code 
True if this sensor activates on negative events.

Deprecated: use invert

setInvert(invert)

source code 
Sets if this sensor activates on positive or negative events.
Parameters:
  • invert (boolean) - true if activates on negative events; false if activates on positive events.

Deprecated: use invert

getLevel()

source code 
Returns whether this sensor is a level detector or a edge detector. It makes a difference only in case of logic state transition (state actuator). A level detector will immediately generate a pulse, negative or positive depending on the sensor condition, as soon as the state is activated. A edge detector will wait for a state change before generating a pulse.
Returns: boolean
true if sensor is level sensitive, false if it is edge sensitive

Deprecated: use level

setLevel(level)

source code 
Set whether to detect level or edge transition when entering a state.
Parameters:
  • level (boolean) - Detect level instead of edge? (KX_TRUE, KX_FALSE)

Deprecated: use level


Instance Variable Details [hide private]

level

Option whether to detect level or edge transition when entering a state. It makes a difference only in case of logic state transition (state actuator). A level detector will immediately generate a pulse, negative or positive depending on the sensor condition, as soon as the state is activated. A edge detector will wait for a state change before generating a pulse. note: mutually exclusive with tap, enabling will disable tap.
Type:
boolean

positive

True if this sensor brick is in a positive state. (read-only)
Type:
boolean

tap

When enabled only sensors that are just activated will send a positive event, after this they will be detected as negative by the controllers. This will make a key thats held act as if its only tapped for an instant. note: mutually exclusive with level, enabling will disable level.
Type:
boolean

triggered

True if this sensor brick is in a positive state. (read-only)
Type:
boolean