GroundedMovementSystem Class
System responsible for horizontal movement. It handles movement while on the ground and in the air. Moving requires that the entity is a valid dynamic physics object, also the GroundedMovement component is required. This system also controlls the FacingDirection, if present. Movement is executed via the input and AI systems triggering the 'moveLeft' and 'moveRight' events. To ensure smooth movement, this system controlls friction directly, so don't rely on the friction set on the Collidable component. This system plays animations. The run animations should be tuned for a specified speed, because this system will modify the rate of run animations based on the entity's horizontal velocity. The animations played are 'runLeft' and 'runRight' if an entity has moved in the direction it wanted while on the ground. The 'stopLeft' and 'stopRight' animations are played if an entity is moving on the ground unwillingly. The 'stopOppositeLeft' animation is played if an entity is moving to the right, but is facing to the left, for the opposite the 'stopOppositeRight' animation will play. While the entity is in the air, if it's moving upwards the 'airAscendLeft' and 'airAscendRight' animations will play. If the entity is moving downwards the 'airDescendLeft' and 'airDescendRight' animations will play.
Constructor
GroundedMovementSystem
-
entitySystemManager
-
inputSystem
-
aISystem
-
physicsSystem
-
collisionMasks
Parameters:
-
entitySystemManager
ManagerThe entity system manager whose entities this system will be working on.
-
inputSystem
KeyboardInputSystem -
aISystem
AISystem -
physicsSystem
PhysicsSystem -
collisionMasks
ObjectAn object holding bit masks used for determining collision categories.