Collision of two rectangles

Hey guys,

I am corrently working on a flappy bird like game and I want to now how it is possible to detect a collusion. Currently the bird is just a rectangle. So I want to know how I in general can check if the rectangle is hitting an obstacle.

Greetings and thank you for your response
Jeyeffkay

1 Like

Here’s a page from stackoverflow, examples written in Java but the algorithm will work the same:

Another page with a more general discussion of collisions between circles, rectangles, and polygons, presented in order of complexity (circles are easiest, polygons are most complex):

3 Likes

Studio.ProcessingTogether.com/sp/pad/export/ro.9bTfM49wCIJza

4 Likes

If you like to learn via video, this YouTube tutorial by Abe Pazos showing overlapping objects and dist() function is very good:

4 Likes

in p5, but easily portable …

4 Likes

Thank you for all of your response. I used the link from GoToLoop but I might try the rest in the future.