Module ...
Handles player running This should work for running inside tunnel, alongside walls, in open spaces.
Functions
_M:runCheck () | Can we continue running ? Rewrite this method to hostiles, interesting terrain, whatever. |
_M:runFollow (path) | Initializes running to a specific position using the given path This does not use the normal running algorithm |
_M:runInit (dir) | Initializes running We check the direction sides to know if we are in a tunnel, along a wall or in open space. |
_M:runMoved () | Called after running a step |
_M:runScan (fct) | Scan the run direction and sides with the given function |
_M:runStep () | Run a turn For a turn based game you want in you player's act() something like that:if not self:runStep() then game.paused = true end This will move the actor using the :move() method, this SHOULD have been redefined by the module to use energy, otherwise running will be free. |
_M:runStop (msg) | Stops running |
_M:runStopped () | Called after stopping running |
Functions
- _M:runCheck ()
-
Can we continue running ? Rewrite this method to hostiles, interesting terrain, whatever. This method should be called by its submethod, it tries to detect changes in the terrain.
It will also try to follow tunnels when they simply change direction.Return value:
true if we can continue to run, false otherwise - _M:runFollow (path)
-
Initializes running to a specific position using the given path This does not use the normal running algorithm
Parameters
- path:
- _M:runInit (dir)
-
Initializes running We check the direction sides to know if we are in a tunnel, along a wall or in open space.
Parameters
- dir:
- _M:runMoved ()
- Called after running a step
- _M:runScan (fct)
-
Scan the run direction and sides with the given function
Parameters
- fct:
- _M:runStep ()
-
Run a turn For a turn based game you want in you player's act() something like that:
if not self:runStep() then game.paused = true end
This will move the actor using the :move() method, this SHOULD have been redefined by the module to use energy, otherwise running will be free.Return value:
true if we can continue to run, false otherwise - _M:runStop (msg)
-
Stops running
Parameters
- msg:
- _M:runStopped ()
- Called after stopping running