Collisions > Collision Points


Loop Over Each Point

For each collision point ...

for each collision point...

Loops over each collision point in the current collision event.

for(point in event.points) {
  [ACTIONS]
}

Collision Point

x of collision

Returns the (x,y) position of the current collision point. Must be used within the for each collision point... wrapper.

Math.round(Engine.toPixelUnits(point.x))
Math.round(Engine.toPixelUnits(point.y))
Math.round(Engine.toPixelUnits(point.normalX))
Math.round(Engine.toPixelUnits(point.normalY))

Get Data for Collided Tile

data for collided tile

Returns the text associated with the tile you collided with. Must be used within the for each collision point... wrapper.

What is this for? You can tag tiles with textual data that can be accessed during game. For example, a lava tile could convey that it's deadly to the touch, or a healing tile in an RPG could heal the character passing over it.
tile-editor

getTileDataForCollision(event, point)