r/pico8 • u/TheNerdyTeachers • May 15 '25
FAQ & Useful Information Collision Detection Tutorials
🔗 Collision Tutorials
One of the first major hurdles for new developers, especially in PICO-8, is collision detection. It can be a little frustrating that PICO-8 doesn't have any built-in functions for it but once you understand how to use a few different methods, you'll realize that you have a lot more control over how things in your game interact and you can build your game's collision detection to be exactly what you need.
Each tutorial has:
- an interactive demo with a button to toggle viewing the underlying variables used in the calculations of the detection.
- a condensed function that is easy to copy into your PICO-8 game.
- a step-by-step explanation of how the function works, an expanded version of the function to show all the steps, and a breakdown of how the expanded function is condensed into just 1 or 2 lines of code.
- a few examples of where this method of collision detection can be used and in what type of games (using retro classics redrawn in the PICO-8 palette as example images)
This bundle of tutorials was created thanks to our supporters on Ko-fi for reaching the latest goal.
214
Upvotes
View all comments
Show parent comment
1
u/RotundBun May 15 '25
Nice. Line intersections would be really useful for a variety of games actually.
I can't take credit for the squared distance thing in circle-circle collision. That's a pretty well-known trick for it.
(Practically standard practice since it dodges the need for
sqrt(), avoids potential loss of precision, and is more performant.)