Module Mob
Main superclass for design enemies, subclass of Entity .
In this case, all the mobs die with the same explosion.
Class Mob
Mob:initialize (x, y, speed, life, state, sprites, animations, anchor, quadCollider, level) | Initialize the object Mob . |
Mob:update (dt) | Update stage. |
Mob:checkCollision () | Checks collisions with the bullets running on the level and manage the damage that inflicts on the mob. |
Mob:kill () | Kill state. |
Mob:followPath (dt) | Makes the mob follow the path described in his attribute path. |
Class Mob
Mob Class, subclass of Entity- Mob:initialize (x, y, speed, life, state, sprites, animations, anchor, quadCollider, level)
-
Initialize the object Mob .
Never create an instance of this class. It’s recomendable work with subclasses.
Parameters:
- x world x coordinate
- y world y coordinate
- speed value px/second
- life amount of life
- state init name state of state machine
- sprites
Image
object that contains SPRITES used in animations. - animations dictionary of animations created with anim8 by kikito, the key is the stateName+facingPosition
- anchor {x,y} table that define the sprite anchor point.
- quadCollider {x1,y1,x2,y2} table with two pair of coordinates.
- level Level where the object belongs
- Mob:update (dt)
-
Update stage.
Parameters:
- dt delta time
- Mob:checkCollision ()
- Checks collisions with the bullets running on the level and manage the damage that inflicts on the mob.
- Mob:kill ()
-
Kill state.
The mob is dead and it’s doing things like “ARGHHH, I'M DYING!!” before being destroyed. - Mob:followPath (dt)
-
Makes the mob follow the path described in his attribute path.
Parameters:
- dt delta time