pygamelib.actuators.PathFinder¶
-
class
pygamelib.actuators.
PathFinder
(game=None, actuated_object=None, circle_waypoints=True, parent=None)¶ Important
This module assume a one step movement. If you need more than one step, you will need to sub-class this module and re-implement next_waypoint().
This actuator is a bit different than the simple actuators (
SimpleActuators
) as it requires the knowledge of both the game object and the actuated object.The constructor takes the following parameters:
Parameters: - game (pygamelib.engine.Game) – A reference to the instanciated game engine.
- actuated_object (pygamelib.board_items.BoardItem) – The object to actuate. Deprecated in favor of parent. Only kept for backward compatibility.
- parent (pygamelib.board_items.BoardItem) – The parent object to actuate.
- circle_waypoints (bool) – If True the next_waypoint() method is going to circle between the waypoints (when the last is visited, go back to the first)
-
__init__
(game=None, actuated_object=None, circle_waypoints=True, parent=None)¶ The constructor simply construct an Actuator. It takes on positional paraneter: the parent object.
Methods
__init__
([game, actuated_object, …])The constructor simply construct an Actuator. add_waypoint
(row, column)Add a waypoint to the list of waypoints. clear_waypoints
()Empty the waypoints stack. current_path
()This method simply return a copy of the current path of the actuator. current_waypoint
()Return the currently active waypoint. find_path
()Find a path to the destination. next_action
()That method needs to be implemented by all behavioral actuators or a NotImplementedError exception will be raised. next_move
()This method return the next move calculated by this actuator. next_waypoint
()Return the next active waypoint. pause
()Set the actuator state to PAUSED. remove_waypoint
(row, column)Remove a waypoint from the stack. set_destination
([row, column])Set the targeted destination. start
()Set the actuator state to RUNNING. stop
()Set the actuator state to STOPPED.