Skip to content

6. Collisions

fowluhhdevbcfunny edited this page Jun 17, 2024 · 2 revisions

To get collisions, you call this in your code:

if (getCollisions(obj1, obj2)) {
    // your code here
}

NOTE: Object 1 and 2 should be a Rect or the graphics RectangleShape and OutlinedRectangleShape, for sprites you must use a Rect with the dimensions and coordinates of the sprite.

To get collisions with TileMaps, you call this in your code:

if (getCollisions(obj1, tile_x, tile_y)) {
    // your code here
}

NOTE: The type that Object 1 should be, as said above, applies to here.

Clone this wiki locally