Accurate intersection detection for sprite nodes?
I am trying to detect collisions between 2 spritenodes, and currently I am using this:
If self.node1.frame.intersects(self.node2.frame) == True: collision = True
Of course this is not ideal when using PNGs, as even when the image displays a triangle, the actual frame is quadratic, resulting in inaccurate intersection detection. Is there any better (more accurate) solution to this?
Apologies if I mixed up some terms, I'm a 15 yr old who only received about 1 year of slow education in the absolute basics such as the print() command and if statements. Everything else (such as using the scene module) is totally self taught.
yeah, that is a bit tricky.
You might find things look better if you check intersection to radius. i.e for square sprites, compute the radius of each sprite, then check
if abs(sprite1.position-sprite2.position) <= (sprite1.bbox.width+sprite2.bbox.width)/2.0
that wont be perfect, but will be a little better.
As an alternative, you have to implement your own simple shape collision detection