Class engine.generator.interface.PlayerRun
Handles player running
This should work for running inside tunnel, alongside walls, in open spaces.
Methods
engine.generator.interface.PlayerRun:runInit (dir)
Initializes running We check the direction sides to know if we are in a tunnel, along a wall or in open space.
engine.generator.interface.PlayerRun:runFollow (path)
Initializes running to a specific position using the given path This does not use the normal running algorithm
engine.generator.interface.PlayerRun:runStep ()
Run a turn 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.
engine.generator.interface.PlayerRun:runCheck ()
Can we continue running?
engine.generator.interface.PlayerRun:runStop (msg)
Stops running
engine.generator.interface.PlayerRun:runScan (fct)
Scan the run direction and sides with the given function
engine.generator.interface.PlayerRun:runMoved ()
Called after running a step
engine.generator.interface.PlayerRun:runStopped ()
Called after stopping running
Methods
- engine.generator.interface.PlayerRun: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
- engine.generator.interface.PlayerRun:runFollow (path)
-
Initializes running to a specific position using the given path
This does not use the normal running algorithm
Parameters:
- path
- engine.generator.interface.PlayerRun:runStep ()
-
Run a turn
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.
For a turn based game you want in you player's act() something like the usage example
Returns:
-
true if we can continue to run
Or
-
false if we can't continue
Usage:
if not self:runStep() then game.paused = true end
- engine.generator.interface.PlayerRun: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.Returns:
-
true if we can continue to run
Or
-
false if we can't continue
- engine.generator.interface.PlayerRun:runStop (msg)
-
Stops running
Parameters:
- msg
- engine.generator.interface.PlayerRun:runScan (fct)
-
Scan the run direction and sides with the given function
Parameters:
- fct
- engine.generator.interface.PlayerRun:runMoved ()
- Called after running a step
- engine.generator.interface.PlayerRun:runStopped ()
- Called after stopping running