Hey guys, so I am trying to use the Rectangle class’s intersects() method for collision detection.
I have created a rectangle that is the same size as the window and I have surrounded my GameObjects with rectangles as well.
The way I thought the .intersects() method worked was if the borders of two rectangles intersect with each other, but it returns true if there is a rectangle inside the another rectangle. Do you guys have any suggestions or a workaround to get the desired behavior?
Why is checking for actual edge collision important versus just checking that they overlap?
If that’s really what you want: [icode]a.intersects(b) && !(a.contains(b) || b.contains(a))[/icode]
That worked, thanks!