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

P#64592 2019-05-19 22:30


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


P#64593 2019-05-19 22:33

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

P#64594 2019-05-19 22:38

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).

P#64605 2019-05-20 02:54

@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.

P#64610 2019-05-20 07:41

@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.

P#64624 2019-05-20 17:58

[Please log in to post a comment]