Log In  


As the title says, I am having trouble with collision detection and would be very grateful if someone could give me a quick code for collision



2

Here's something I made a while back to help explain how to do collision detection. Hope it helps a bit!

https://mboffin.itch.io/pico8-overlap


my issue is that i can't remember the code for it


That page has code for collision detection. The two things you are checking collision on just each need an x,y coordinate and a w,h (width and height).


@MBoffin: Nice little tutorial! Just a suggestion, maybe you should add the term "AABB"/"axis-aligned bounding box" to your itch page there, so people understand that's the collision algorithm they're looking at? They're bound (pun intended) to encounter that term elsewhere while learning.


@tobiasvl Thanks! Yeah, I did think about that, but I opted not to because of who I end up using the tutorial for most. I end up using it quite a lot with younger students, who are also trying to absorb and understand so many other concepts at the same time, so I didn't want to toss in one more thing for them to try to retain and think with.



[Please log in to post a comment]