Module entity.player
Player class, subclass of Entity .
SPEED = 100
STATE = 'stop|walk'
Class Player
Player:initialize (x, y, level) | Initialize the object Player . |
Player:update (dt) | Update stage. |
Player:drawMouse () | Draw in canvas the player spotlight. |
Player:_aiming () | Calculates the zone where the player is aiming. |
Player:_handleWeapon (dt, aimVector) | Handle weapong function, fire it’s neccesary. |
State machine
Player:_stopState (dt) | “stop” state of the state machine. |
Player:_walkState (dt) | “walk” state of the state machine. |
Class Player
Player Class, subclass of Entity- Player:initialize (x, y, level)
-
Initialize the object Player .
Don’t call this method directly!, this method is called automatically when the class is instanciated using the method new.
Parameters:
- x world x coordinate
- y world y coordinate
- level Level where the object belongs
Usage:
Player:new(x,y,level)
- Player:update (dt)
-
Update stage.
Parameters:
- dt delta time
- Player:drawMouse ()
- Draw in canvas the player spotlight.
- Player:_aiming ()
- Calculates the zone where the player is aiming.
- Player:_handleWeapon (dt, aimVector)
-
Handle weapong function, fire it’s neccesary.
Parameters:
- dt delta time
- aimVector direction vector