Home | Trees | Indices | Help |
|
---|
|
All the other modules are accessible through the methods in GameLogic.
See WhatsNew for updates, changes and new functionality in the Game Engine Python API.
Examples:# To get a controller: import GameLogic co = GameLogic.getCurrentController() # To get the game object associated with this controller: obj = co.getOwner()KX_GameObject and KX_Camera or KX_Light methods are available depending on the type of object:
# To get a sensor linked to this controller. # "sensorname" is the name of the sensor as defined in the Blender interface. # +---------------------+ +--------+ # | Sensor "sensorname" +--+ Python + # +---------------------+ +--------+ sens = co.getSensor("sensorname") # To get a list of all sensors: sensors = co.getSensors()See the sensor's reference for available methods:
# To get an actuator attached to the controller: # +--------+ +-------------------------+ # + Python +--+ Actuator "actuatorname" | # +--------+ +-------------------------+ actuator = co.getActuator("actuatorname") # Activate an actuator GameLogic.addActiveActuator(actuator, True)See the actuator's reference for available methods:
Most logic brick's methods are accessors for the properties available in the logic buttons. Consult the logic bricks documentation for more information on how each logic brick works.
There are also methods to access the current KX_Scene:# Get the current scene scene = GameLogic.getCurrentScene() # Get the current camera cam = scene.active_cameraMatricies as used by the game engine are row major:
matrix[row][col] = blahKX_Camera has some examples using matricies.
Functions | |||
SCA_PythonController |
|
||
KX_Scene |
|
||
|
|||
|
|||
|
|||
list [float], len(getSpectrum()) == 512 |
|
||
|
|||
float |
|
||
|
|||
float |
|
||
|
|||
string |
|
Variables | |
Constants | |
---|---|
KX_FALSE False value used by some modules. |
|
KX_TRUE True value used by some modules. |
|
Property Sensor | |
KX_PROPSENSOR_CHANGED Activate when the property changes |
|
KX_PROPSENSOR_EQUAL Activate when the property is equal to the sensor value. |
|
KX_PROPSENSOR_EXPRESSION Activate when the expression matches |
|
KX_PROPSENSOR_INTERVAL Activate when the property is between the specified limits. |
|
KX_PROPSENSOR_NOTEQUAL Activate when the property is not equal to the sensor value. |
|
Constraint Actuator | |
KX_CONSTRAINTACT_LOCX See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_LOCY See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_LOCZ See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_ROTX See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_ROTY See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_ROTZ See KX_ConstraintActuator |
|
IPO Actuator | |
KX_IPOACT_FLIPPER See KX_IpoActuator |
|
KX_IPOACT_LOOPEND See KX_IpoActuator |
|
KX_IPOACT_LOOPSTOP See KX_IpoActuator |
|
KX_IPOACT_PINGPONG See KX_IpoActuator |
|
KX_IPOACT_PLAY See KX_IpoActuator |
|
Random Distributions | |
KX_RANDOMACT_BOOL_BERNOUILLI See SCA_RandomActuator |
|
KX_RANDOMACT_BOOL_CONST See SCA_RandomActuator |
|
KX_RANDOMACT_BOOL_UNIFORM See SCA_RandomActuator |
|
KX_RANDOMACT_FLOAT_CONST See SCA_RandomActuator |
|
KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL See SCA_RandomActuator |
|
KX_RANDOMACT_FLOAT_NORMAL See SCA_RandomActuator |
|
KX_RANDOMACT_FLOAT_UNIFORM See SCA_RandomActuator |
|
KX_RANDOMACT_INT_CONST See SCA_RandomActuator |
|
KX_RANDOMACT_INT_POISSON See SCA_RandomActuator |
|
KX_RANDOMACT_INT_UNIFORM See SCA_RandomActuator |
|
Action Actuator | |
KX_ACTIONACT_FLIPPER See BL_ActionActuator |
|
KX_ACTIONACT_LOOPEND See BL_ActionActuator |
|
KX_ACTIONACT_LOOPSTOP See BL_ActionActuator |
|
KX_ACTIONACT_PLAY See BL_ActionActuator |
|
KX_ACTIONACT_PROPERTY See BL_ActionActuator |
|
Sound Actuator | |
KX_SOUNDACT_LOOPBIDIRECTIONAL See KX_SoundActuator |
|
KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP See KX_SoundActuator |
|
KX_SOUNDACT_LOOPEND See KX_SoundActuator |
|
KX_SOUNDACT_LOOPSTOP See KX_SoundActuator |
|
KX_SOUNDACT_PLAYEND See KX_SoundActuator |
|
KX_SOUNDACT_PLAYSTOP See KX_SoundActuator |
Function Details |
|
|
|
Stops the sound driver using DSP effects. Only the fmod sound driver supports this. DSP can be computationally expensive. |
|
Sets the logic update frequency. The logic update frequency is the number of times logic bricks are executed every second. The default is 30 Hz.
|
|
Sets the physics update frequency The physics update frequency is the number of times the physics system is executed every second. The default is 60 Hz.
|
Converts a blender internal path into a proper file system path. Use / as directory separator in path You can use '//' at the start of the string to define a relative path; Blender replaces that string by the directory of the startup .blend or runtime file to make a full path name (doesn't change during the game, even if you load other .blend). The function also converts the directory separator to the local file system format.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Tue May 20 07:56:37 2008 | http://epydoc.sourceforge.net |