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

[pygame] Drawing Transparent Sprites



I built a system of sprites and a tiled, scrolling world, and am having trouble drawing the sprites when they move.

The world has a big Surface that's drawn once, with a clipping rectangle used to blit part of it to the screen in each frame. The sprites were using a system by which they drew themselves to the world's Surface and cleaned up after themselves, but (a) that was complicated, (b) it didn't work well when they moved, and (c) it didn't work well when they were near other sprites. I tried giving the world a "sprite_layer" Surface that could be drawn on top of the existing one and cleared each frame, but that didn't work because it's opaque and black, and I'm not sure how to make it transparent only in areas where sprites (which might be black) have been drawn. Suggestions?

Kris