Game Creation Kit: Last modified 02/02/07 17:04:05 cw
Prev | Chapter 28. Python | Next

# 28.4. Standard methods for LogicBricks

All LogicBricks inherit the following methods:

``gameObject*getOwner`( );`

This returns the owner of the GameObject the LogicBrick is assigned to.

## 28.4.1. Standard methods for Sensors

All sensors inherit the following methods:

``int isPositive`( );`

True if the sensor fires a positive pulse. Very usefull for example to differentiate the press and release state from a KeyboardSensor.

``bool getUsePosPulseMode`( );`

Returns TRUE if positive pulse mode is active, FALSE if positive pulse mode is not active.

``setUsePosPulseMode`( bool flag );`

Set "flag" to TRUE to switch on positive pulse mode, FALSE to switch off positive pulse mode.

``int getPosFrequency`( );`

Returns the frequency of the updates in positive pulse mode.

``setPosFrequency`( int freq );`

Sets the frequency of the updates in positive pulse mode. If the frequency is negative, it is set to 0.

``bool getUseNegPulseMode`( );`

Returns TRUE if negative pulse mode is active, FALSE if negative pulse mode is not active.

``setUseNegPulseMode`( bool flag );`

Set "flag" to TRUE to switch on negative pulse mode, FALSE to switch off negative pulse mode.

``int getNegFrequency`( );`

Returns the frequency of the updates in negative pulse mode.

``setNegFrequency`( int freq );`

Sets the frequency of the updates in negative pulse mode. If the frequency is negative, it is set to 0.

``bool getInvert`( );`

Returns whether or not pulses from this sensor are inverted.

``setInvert`( bool flag );`

Set "flag" to TRUE to invert the responses of this sensor, set to FALSE to keep the normal response.

## 28.4.2. Standard methods for Controllers

Controllers have the following methods:

``Actuator* getActuator`( char* name , );`

Returns the actuator with "name".

``list getActuators`( );`

Returns a python list of all connected Actuators.

``Sensor* getSensor`( char* name , );`

Returns the Sensor with "name".

``list getSensors`( );`

Returns a python list of all connected Sensors.

## 28.4.3. Standard methods for GameObjects

The GameObjects you got with getOwner() provide the following methods.

``applyImpulse`( list [x,y,z] , );`

Apply impulse to the gameObject (N*s).

``disableRigidBody`( );`

Disables the rigid body dynamics for the gameObject.

``enableRigidBody`( , );`

Enables the rigid body dynamics for the gameObject.

``setVisible`( int visible );`

Sets the GameObject to visible (int visible=1) or invisible (int visible=0), this state is true until the next frame-draw. Use "enableVisibility( bool usevisibility );" from the Rasterizer Module to make all objects invisible.

``setPosition`( [x,y,z] );`

Sets the position of the gameObject according to the list of the X, Y and Z coordinate.

``pylist [x,y,z] getPosition`( );`

Gets the position of the gameObject as list of the X, Y and Z coordinate.

``pylist [x,y,z] getLinearVelocity`( );`

Returns a list with the X, Y and Z component of the linear velocity. The speed is in Blender units per second.

``pylist [x,y,z] getVelocity`( );`

Returns a list with the X, Y and Z component of the velocity. The speed is in Blenderunits/second.

``float mass getMass`( );`

Returns the mass of the GameObject.

``pylist [x,y,z] getReactionForce`( );`

Returns a Python list of three elements.

``suspendDynamics`( );`

Suspends the dynamic calculation in the game engine.

``restoreDynamics`( );`

Suspends the dynamic calculation in the game engine.

Prev | Home | Next
Game Python Documentation per module | Up | Appendix