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

Re: [pygame] Drawing Transparent Sprites



Ehum...if you already is blitting the background (part of the big Surface)
to the screen each frame, there is no need for the sprites to be clearded
out (the blitting of the background has already cleared them).

Do it like this each frame:

1. Blit the background
2. Blit all sprites
3. Blit some more if needed...like score text and such.

Best Regards
/John

>
> 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
>
>
>
>
>