collision:
What is Collision?
When you play a video game, characters jump on platforms, enemies bump into each other, and items get picked up when touched. All of that happens thanks to something called collision detection, checking when something collides.
Collision is when two things in a game touch or overlap. The game needs to detect when this happens so it can respond appropriately. Sometimes things are allowed to overlap, or pass in front or behind one another, while other times they should bump, bounce, crash, hurt, collect, etc. In all cases, it is better to know where your game objects are in relation to each other, and have them respond correctly.
What is Collision in Games?

Something as simple as having a character walking and jumping on the ground uses collision detection.

Collecting points, items, or resources uses collision detection.

Players interacting with objects in the game or with each other uses collision detection.

Enemies hurting or killing the player uses collision detection.
Without collision detection, everything would just pass through everything else. Some interactions in games are caused by button presses, or timers that trigger changes, but the rest happen because of some form of collision detection. So collision detection is an important part in all types of games!
PICO-8 Does Not have Built-in Collision Detection
Many game engines have different types of collision detection built into the engine, and you can apply different colliders to objects by clicking a few buttons. But PICO-8 does not provide any for you. This can be a frustrating realization, especially if you don't know where to start to make things in your game interact with each other. However, once you learn a few ways you can build your own collision in games, you realize how much power and control you have over exactly how things in your game interact.
Types of Collision Detection
There are many different types of collision detection, most based on the different shapes of your game objects. There are a few types that don't depend on shapes such as boundary collision, color-based collision, and map collision, which is a simple place to start.
For the more traditional shape-based collision, we'll use geometry to figure out if two shapes are touching. As complicated as they might seem, they all need just 3 things:
- The positions of your game objects (coordinates X and Y ).
- The size of the objects (width, height, or radius).
- The rule for checking if they overlap, which is different for different shapes.

67
21 Apr 2025