Class engine.GameEnergyBased

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)

Methods

engine.GameEnergyBased:init (keyhandler, energy_to_act, energy_per_tick)

Setup the game

engine.GameEnergyBased:loaded ()

The function called after the game has loaded

engine.GameEnergyBased:tick ()

Give energy and act if needed

engine.GameEnergyBased:tickLevel (level)

Run tick on a level

engine.GameEnergyBased:onTurn ()

Called every game turns Does nothing, you can override it

engine.GameEnergyBased: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.

engine.GameEnergyBased:removeEntity (e)

Removes an entity from the game

engine.GameEnergyBased:hasEntity (e)

Does the game have this entity ?



Methods

engine.GameEnergyBased:init (keyhandler, energy_to_act, energy_per_tick)
Setup the game

Parameters:

  • keyhandler Key the default keyhandler for this game
  • energy_to_act number how much energy does an entity need to act
  • energy_per_tick number how much energy does an entity receives per game tick. This is multiplied by the entity energy.mod property
engine.GameEnergyBased:loaded ()
The function called after the game has loaded
engine.GameEnergyBased:tick ()
Give energy and act if needed
engine.GameEnergyBased:tickLevel (level)
Run tick on a level

Parameters:

engine.GameEnergyBased:onTurn ()
Called every game turns Does nothing, you can override it
engine.GameEnergyBased: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:

engine.GameEnergyBased:removeEntity (e)
Removes an entity from the game

Parameters:

engine.GameEnergyBased:hasEntity (e)
Does the game have this entity ?

Parameters:

generated by LDoc 1.4.3