[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Possible to detect collision with an image?



I'm using an image with transparency as a Sprite. The image has an irregular shape:

http://sinkingsensation.com/stuff/shape.png

I'd like to detect collisions with it.

My current strategy is to draw a polygon (pygame.draw.polygon) behind the image. That works, but its difficult to make the polygon accurately reflect the image, and I need to make a lot of them.

So I'm wondering if there's some way to detect collisions with the image itself?

Or maybe there's some clever way to draw a polygon based on an image?

I don't need pixel-by-pixel accuracy, anything close would work.