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

Re: [pygame] Sprites



On Sat, 2006-08-05 at 01:03 +0100, Brain Murphy wrote:
> Is it possible to change the colour of a sprite starting at one end
> and finishing at the other? so if I have a pipe, and want the pipe to
> change to green or red or whatever, could I have it start the change
> at one end and finish at another?
> Is there a tutorial were this type of thing is posted?
> I am really interested in this but am stuck at no were.

If you keep your images as 8bit images with palettes, you can change the
colors in the palette pretty quick. Solarwolf does this to create color
variations for several objects.

If possible, do this at init time, and keep a range of images with the
colors you want. Bit if the images are large it could quickly eat up
your memory.

With Numeric you could change the palette very fast, but regular python
can probably do it fast enough. SDL will handle blitting the 8bit
Surface onto the screen, but it will be a little slower than the
matching pixel format.