Simple Collision Function

0
0
Published 2023-06-12


I've seen some questions about how to do collision detection in Pico-8, so figured I'd make another bare-bones demo, this one demonstrating collision detection with map tiles and/or world bounds. The function itself is 24 lines and 125 tokens, and includes flags for turning collisions on or off on an object (such as the player). Here's the full function:

It will return true if a collision is detected, and the object has the flag(s) set for collisions. To set up the function for use, you need the following global variables/properties set:

To call the function, simply use: cmap([object]).