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

Re: [pygame] Masks?



I would create separate surfaces and masks for each frame. If you want to keep all the frames in one surface, you can use subsurfaces for each frame: http://www.pygame.org/docs/ref/surface.html#Surface.subsurface.

Then create the masks out of the subsurfaces and use Mask.overlap to do the intersection testing.

--Mike

inigo delgado wrote:
Hi all:

I don't have clear how to use the masks to collisions....

I have a bmps with a keycolor and with many frames of the same
spaceship in each and blit a area of them to simulate movement....

How can I do a mask of one part -a frame- of the bmp to see if it
collides with another part -another frame- of another bmp? To find a
exact collision of both? I've done collisions with rectangles, but I
wanna put big ships (like level bosses or medium size ships) and in
that ships this aproximation is poor, so I want, if is a rectangle
collition, to have the posibility of know if its a real collision

If I do a mask of the bmps, I understand that then pygame will test
all the frames in each bmp with all frames of the other bmp?...?¿