Home | Trees | Indices | Help |
|
---|
|
Module to access logic functions, imported automatically into the python controllers namespace.
Examples:
# To get the controller thats running this python script: cont = GameLogic.getCurrentController() # GameLogic is automatically imported # To get the game object this controller is on: obj = cont.owner
KX_GameObject and KX_Camera or KX_LightObject 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 = cont.sensors["sensorname"] # To get a sequence of all sensors: sensors = co.sensors
See the sensor's reference for available methods:
You can also access actuators linked to the controller:
# To get an actuator attached to the controller: # +--------+ +-------------------------+ # + Python +--+ Actuator "actuatorname" | # +--------+ +-------------------------+ actuator = co.actuators["actuatorname"] # Activate an actuator controller.activate(actuator)
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_camera
Matricies as used by the game engine are row major:
matrix[row][col] = float
KX_Camera has some examples using matricies.
Functions | |||
SCA_PythonController |
|
||
KX_Scene |
|
||
list of KX_Scene |
|
||
|
|||
|
|||
list [float], len(getSpectrum()) == 512 |
|
||
|
|||
interger |
|
||
|
|||
interger |
|
||
|
|||
float |
|
||
|
|||
float |
|
||
|
|||
Utility functions | |||
---|---|---|---|
float |
|
||
string |
|
||
list |
|
||
|
|||
|
|||
Deprecated | |||
|
Variables | |
__package__ = None
|
|
globalDict A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. |
|
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_ACT_CONSTRAINT_DISTANCE | |
KX_ACT_CONSTRAINT_DOROTFH | |
KX_ACT_CONSTRAINT_FHNX | |
KX_ACT_CONSTRAINT_FHNY | |
KX_ACT_CONSTRAINT_FHNZ | |
KX_ACT_CONSTRAINT_FHPX | |
KX_ACT_CONSTRAINT_FHPY | |
KX_ACT_CONSTRAINT_FHPZ | |
KX_ACT_CONSTRAINT_LOCAL | |
KX_ACT_CONSTRAINT_MATERIAL | |
KX_ACT_CONSTRAINT_NORMAL | |
KX_ACT_CONSTRAINT_PERMANENT | |
KX_CONSTRAINTACT_DIRNX See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_DIRNY See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_DIRPX See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_DIRPY See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_LOCX See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_LOCY See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_LOCZ See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_ORIX See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_ORIY See KX_ConstraintActuator |
|
KX_CONSTRAINTACT_ORIZ 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_FROM_PROP 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 |
|
Radar Sensor | |
KX_RADAR_AXIS_NEG_X See KX_RadarSensor |
|
KX_RADAR_AXIS_NEG_Y See KX_RadarSensor |
|
KX_RADAR_AXIS_NEG_Z See KX_RadarSensor |
|
KX_RADAR_AXIS_POS_X See KX_RadarSensor |
|
KX_RADAR_AXIS_POS_Y See KX_RadarSensor |
|
KX_RADAR_AXIS_POS_Z See KX_RadarSensor |
|
Ray Sensor | |
KX_RAY_AXIS_NEG_X See KX_RaySensor |
|
KX_RAY_AXIS_NEG_Y See KX_RaySensor |
|
KX_RAY_AXIS_NEG_Z See KX_RaySensor |
|
KX_RAY_AXIS_POS_X See KX_RaySensor |
|
KX_RAY_AXIS_POS_Y See KX_RaySensor |
|
KX_RAY_AXIS_POS_Z See KX_RaySensor |
|
Dynamic Actuator | |
KX_DYN_DISABLE_DYNAMICS See KX_SCA_DynamicActuator |
|
KX_DYN_DISABLE_RIGID_BODY See KX_SCA_DynamicActuator |
|
KX_DYN_ENABLE_RIGID_BODY See KX_SCA_DynamicActuator |
|
KX_DYN_RESTORE_DYNAMICS See KX_SCA_DynamicActuator |
|
KX_DYN_SET_MASS See KX_SCA_DynamicActuator |
|
Game Actuator | |
KX_GAME_LOAD See KX_GameActuator |
|
KX_GAME_LOADCFG See KX_GameActuator |
|
KX_GAME_QUIT See KX_GameActuator |
|
KX_GAME_RESTART See KX_GameActuator |
|
KX_GAME_SAVECFG See KX_GameActuator |
|
KX_GAME_START See KX_GameActuator |
|
Scene Actuator | |
KX_SCENE_ADD_BACK_SCENE See KX_SceneActuator |
|
KX_SCENE_ADD_FRONT_SCENE See KX_SceneActuator |
|
KX_SCENE_REMOVE_SCENE See KX_SceneActuator |
|
KX_SCENE_RESTART See KX_SceneActuator |
|
KX_SCENE_RESUME See KX_SceneActuator |
|
KX_SCENE_SET_CAMERA See KX_SceneActuator |
|
KX_SCENE_SET_SCENE See KX_SceneActuator |
|
KX_SCENE_SUSPEND See KX_SceneActuator |
|
Input Status | |
KX_INPUT_ACTIVE See SCA_MouseSensor |
|
KX_INPUT_JUST_ACTIVATED See SCA_MouseSensor |
|
KX_INPUT_JUST_RELEASED See SCA_MouseSensor |
|
KX_INPUT_NONE See SCA_MouseSensor |
|
Mouse Buttons | |
KX_MOUSE_BUT_LEFT See SCA_MouseSensor |
|
KX_MOUSE_BUT_MIDDLE See SCA_MouseSensor |
|
KX_MOUSE_BUT_RIGHT See SCA_MouseSensor |
|
States | |
KX_STATE1 | |
KX_STATE10 | |
KX_STATE11 | |
KX_STATE12 | |
KX_STATE13 | |
KX_STATE14 | |
KX_STATE15 | |
KX_STATE16 | |
KX_STATE17 | |
KX_STATE18 | |
KX_STATE19 | |
KX_STATE2 | |
KX_STATE20 | |
KX_STATE21 | |
KX_STATE22 | |
KX_STATE23 | |
KX_STATE24 | |
KX_STATE25 | |
KX_STATE26 | |
KX_STATE27 | |
KX_STATE28 | |
KX_STATE29 | |
KX_STATE3 | |
KX_STATE30 | |
KX_STATE4 | |
KX_STATE5 | |
KX_STATE6 | |
KX_STATE7 | |
KX_STATE8 | |
KX_STATE9 | |
KX_STATE_OP_CLR | |
KX_STATE_OP_CPY | |
KX_STATE_OP_NEG | |
KX_STATE_OP_SET | |
2D Filter | |
RAS_2DFILTER_BLUR | |
RAS_2DFILTER_CUSTOMFILTER | |
RAS_2DFILTER_DILATION | |
RAS_2DFILTER_DISABLED | |
RAS_2DFILTER_ENABLED | |
RAS_2DFILTER_EROSION | |
RAS_2DFILTER_GRAYSCALE | |
RAS_2DFILTER_INVERT | |
RAS_2DFILTER_LAPLACIAN | |
RAS_2DFILTER_MOTIONBLUR | |
RAS_2DFILTER_NOFILTER | |
RAS_2DFILTER_PREWITT | |
RAS_2DFILTER_SEPIA | |
RAS_2DFILTER_SHARPEN | |
RAS_2DFILTER_SOBEL | |
Parent Actuator | |
KX_PARENT_REMOVE | |
KX_PARENT_SET | |
Shader | |
CAM_POS Current camera position |
|
CONSTANT_TIMER User a timer for the uniform value. |
|
MODELMATRIX | |
MODELMATRIX_INVERSE | |
MODELMATRIX_INVERSETRANSPOSE | |
MODELMATRIX_TRANSPOSE | |
MODELVIEWMATRIX | |
MODELVIEWMATRIX_INVERSE | |
MODELVIEWMATRIX_INVERSETRANSPOSE | |
MODELVIEWMATRIX_TRANSPOSE | |
SHD_TANGENT Not yet documented. |
|
VIEWMATRIX | |
VIEWMATRIX_INVERSE | |
VIEWMATRIX_INVERSETRANSPOSE | |
VIEWMATRIX_TRANSPOSE | |
Blender Material | |
BL_DST_ALPHA | |
BL_DST_COLOR | |
BL_ONE | |
BL_ONE_MINUS_DST_ALPHA | |
BL_ONE_MINUS_DST_COLOR | |
BL_ONE_MINUS_SRC_ALPHA | |
BL_ONE_MINUS_SRC_COLOR | |
BL_SRC_ALPHA | |
BL_SRC_ALPHA_SATURATE | |
BL_SRC_COLOR | |
BL_ZERO |
Function Details |
Gets a list of the current scenes loaded in the game engine.
Note: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes. |
Activates the given actuator.
Deprecated: Use GameTypes.SCA_PythonController.activate and GameTypes.SCA_PythonController.deactivate instead. |
Sends a message to sensors in any active scene.
|
Sets the world gravity.
|
Returns a 512 point list from the sound card. This only works if the fmod sound driver is being used.
|
Stops the sound driver using DSP effects. Only the fmod sound driver supports this. DSP can be computationally expensive. |
Gets the maximum number of logic frame per render frame.
|
Sets the maximum number of logic frame that are executed per render frame. This does not affect the physic system that still runs at full frame rate.
|
Gets the maximum number of physics frame per render frame.
|
Sets the maximum number of physics timestep that are executed per render frame. Higher value allows physics to keep up with realtime even if graphics slows down the game. Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate) maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
|
Gets the logic update frequency.
|
Sets the logic update frequency. The logic update frequency is the number of times logic bricks are executed every second. The default is 60 Hz.
|
NOT IMPLEMENTED Gets the physics update frequency
|
NOT IMPLEMENTED 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.
|
Gets the estimated average framerate
|
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.
|
Returns a list of blend files in the same directory as the open blend file, or from using the option argument.
|
Variables Details |
globalDictA dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. It can also be written to a file and loaded later on with the game load/save actuators. note: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expectred. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Mon Aug 31 23:12:30 2009 | http://epydoc.sourceforge.net |