- Psykick2D
Platformer
Handles basic platformer physics
new Platformer(
options
)
Parameters
options | object | ||
options.x | number | X position of the collidable zone | 0 |
options.y | number | Y position of the collidable zone | 0 |
options.width | number | Width of the collidable zone | |
options.height | number | Height of collidable | |
options.gravity | number | Force of gravity | 9.8 |
Properties
requiredComponents | ARRAY | [] | |
gravity | number | 9.8 | |
collisionStructure | QuadTree | new QuadTree() | |
_collisionHandlers | ARRAY | private | [] |
Methods
boolean addEntity( )
Adds an entity to the collision system
entity | Entity |
boolean removeEntity( )
Removes an entity from the collision system
entity |
addCollisionListener( )
Adds a listener for when a collision occurs
callback |
removeCollisionListener( )
Removes a collision listener
callback |
_emit( )
Alerts listeners about a collision
a | Entity | ||
b | Entity |
update( )
Deals with all of the collisions
delta | number |