BGE Py API

* Made GameLogic.addActiveActuator(actu, bool) to raise an error if the actuator is not in the list. Before it would allow any value as the actuator and fail silently (makes debugging scripts more difficult).

* Allow the actuator to be a string which is convenient if you dont want to change the settings of the actuator.
* Added activate/deactivate functions to the controller, this is more logical since the GameLogic.addActiveActuator() function is running through the controller anyway.

GameLogic.addActiveActuator(controller.getActuator("SomeAct"), True)
...can be replaced with...
controller.activate("SomeAct")
This commit is contained in:
2009-02-24 05:50:45 +00:00
parent 394d893e13
commit 6c7c38a4e4
5 changed files with 86 additions and 25 deletions

View File

@@ -15,7 +15,17 @@ class SCA_PythonController(SCA_IController):
This can be used with the GameObject's state to test if the controller is active.
@type state: integer
"""
def activate(actuator):
"""
Activates an actuator attached to this controller.
@type actuator: actuator or the actuator name as a string
"""
def deactivate(actuator):
"""
Deactivates an actuator attached to this controller.
@type actuator: actuator or the actuator name as a string
"""
def getSensors():
"""
Gets a list of all sensors attached to this controller.