Actuators¶
This module contains the base classes for simple and advanced actuators. These classes are the base contract for actuators. If you wish to create your own one, you need to inheritate from one of these base class.
-
class
gamelib.Actuators.Actuator.
Actuator
(parent)¶ Bases:
object
Actuator is the base class for all Actuators. It is mainly a contract class with some utility methods.
By default, all actuators are considered movement actuators. So the base class only require next_move() to be implemented.
Parameters: parent – the item parent. -
next_move
()¶ That method needs to be implemented by all actuators or a NotImplementedError exception will be raised.
Raises: NotImplementedError
-
pause
()¶ Set the actuator state to PAUSED.
Example:
mygame.pause()
-
start
()¶ Set the actuator state to RUNNING.
If the actuator state is not RUNNING, actuators’ next_move() function (and all derivatives) should not return anything.
Example:
mygame.start()
-
stop
()¶ Set the actuator state to STOPPED.
Example:
mygame.stop()
-
-
class
gamelib.Actuators.Actuator.
Behavioral
(parent)¶ Bases:
gamelib.Actuators.Actuator.Actuator
The behavioral actuator is inheriting from Actuator and is adding a next_action() method. The actual actions are left to the actuator that implements Behavioral.
Parameters: parent – the item parent. -
next_action
()¶ That method needs to be implemented by all behavioral actuators or a NotImplementedError exception will be raised.
Raises: NotImplementedError
-
next_move
()¶ That method needs to be implemented by all actuators or a NotImplementedError exception will be raised.
Raises: NotImplementedError
-
pause
()¶ Set the actuator state to PAUSED.
Example:
mygame.pause()
-
start
()¶ Set the actuator state to RUNNING.
If the actuator state is not RUNNING, actuators’ next_move() function (and all derivatives) should not return anything.
Example:
mygame.start()
-
stop
()¶ Set the actuator state to STOPPED.
Example:
mygame.stop()
-