Class engine.generator.interface.ActorLife
Handles actors life and death
Methods
engine.generator.interface.ActorLife:block_move (x, y, e, can_attack)
Checks if something bumps in us If it happens the method attack is called on the target with the attacker as parameter.
engine.generator.interface.ActorLife:regenLife ()
Regenerate life, call it from your actor class act() method
engine.generator.interface.ActorLife:heal (value, src)
Heal some
engine.generator.interface.ActorLife:takeHit (value, src, death_note)
Remove some HP from an actor
If HP is reduced to 0 then remove from the level and call the die method.
engine.generator.interface.ActorLife:die (src, death_note)
Called when died
engine.generator.interface.ActorLife:attack (target, x, y)
Actor is being attacked! Module authors should rewrite it to handle combat, dialog, ...
Methods
- engine.generator.interface.ActorLife:block_move (x, y, e, can_attack)
-
Checks if something bumps in us
If it happens the method attack is called on the target with the attacker as parameter.
Do not touch!
Parameters:
- x
- y
- e
- can_attack Dont bump yourself!
- engine.generator.interface.ActorLife:regenLife ()
- Regenerate life, call it from your actor class act() method
- engine.generator.interface.ActorLife:heal (value, src)
-
Heal some
Parameters:
- value
- src
- engine.generator.interface.ActorLife:takeHit (value, src, death_note)
-
Remove some HP from an actor
If HP is reduced to 0 then remove from the level and call the die method.
When an actor dies its dead property is set to true, to wait until garbage collection deletes itParameters:
- value how much damage
- src attacker
- death_note string message for death
Returns:
- true/false if the actor died
- the actual damage done
- engine.generator.interface.ActorLife:die (src, death_note)
-
Called when died
Parameters:
- src attacker
- death_note string message for death
- engine.generator.interface.ActorLife:attack (target, x, y)
-
Actor is being attacked!
Module authors should rewrite it to handle combat, dialog, ...
Parameters:
- target the actor attacking us
- x placeholder
- y placeholder