Module ...

A game type that gives each entities energy When an entity reaches an energy level it is allowed to act (it calls the entity"s "act" method)

Functions

_M:addEntity (e) Adds an entity to the game This differs from Level:addEntity in that it's not specific to actors and the entities are not bound to the current level.
_M:hasEntity (e) Does the game have this entity ?
_M:init (keyhandler, energy_to_act, energy_per_tick) Setup the game
_M:onTurn () Called every game turns Does nothing, you can override it
_M:removeEntity (e) Removes an entity from the game
_M:tick () Gives energy and act if needed
_M:tickLevel (level) Run tick on a level


Functions

_M:addEntity (e)
Adds an entity to the game This differs from Level:addEntity in that it's not specific to actors and the entities are not bound to the current level. Also they are stored in a *WEAK* table, so this wont hold them from garbage collecting if they are not

Parameters

  • e:
_M:hasEntity (e)
Does the game have this entity ?

Parameters

  • e:
_M:init (keyhandler, energy_to_act, energy_per_tick)
Setup the game

Parameters

  • keyhandler: the default keyhandler for this game
  • energy_to_act:
  • energy_per_tick:
_M:onTurn ()
Called every game turns Does nothing, you can override it
_M:removeEntity (e)
Removes an entity from the game

Parameters

  • e:
_M:tick ()
Gives energy and act if needed
_M:tickLevel (level)
Run tick on a level

Parameters

  • level:

Valid XHTML 1.0!