HandlerCollision

platypus.components. HandlerCollision

new HandlerCollision()

This component checks for collisions between entities which typically have either a CollisionTiles component for tile maps or a CollisionBasic component for other entities. It uses EntityContainer component messages if triggered to add to its collision list and also listens for explicit add/remove messages (useful in the absence of an EntityContainer component).

Source:
Fires:
Listens to Events:

Methods

getEntityCollisions(entity) → {Array}

This method returns a list of collision objects describing soft collisions between an entity and a list of other entities.

Source:
Parameters:
Name Type Description
entity Entity

The entity to test against the world.

Returns:
Type:
Array

collisions This is a list of collision objects describing the soft collisions.

getPointCollisions(x, y, collisionTypes) → {Array}

This method returns a list of collision objects describing collisions between a point and a list of other entities.

Source:
Parameters:
Name Type Description
x number

The x-axis value.

y number

The y-axis value.

collisionTypes Array.<String>

The collision types to check against.

Returns:
Type:
Array

collisions This is a list of collision objects describing the soft collisions.

getShapeCollisions(shape, collisionTypes) → {Array}

This method returns a list of collision objects describing collisions between a shape and a list of other entities.

Source:
Parameters:
Name Type Description
shape CollisionShape

The shape to check for collisions.

collisionTypes Array.<String>

The collision types to check against.

Returns:
Type:
Array

collisions This is a list of collision objects describing the soft collisions.

getWorldEntities() → {Array}

This method returns an object containing world entities.

Source:
Returns:
Type:
Array

A list of all world collision entities.

getWorldTerrain() → {Entity}

This method returns an entity representing the collision map of the world.

Source:
Returns:
Type:
Entity
  • An entity describing the collision map of the world. This entity typically includes a CollisionTiles component.