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

Re: [pygame] Animated sprites



Dan wrote:

Does anyone have a recommended way of making animated sprites?

I read the source code to SolarWolf and saw the way Pete Shinners does
it, which is pretty much what you would expect: load a list of images
and blit them in sequence. (I also noticed his animstrip() function,
which cleverly cuts a single long image into multiple small ones. Good
thinking, Pete!)

Since Pete is certainly an expert on pygame, I would guess that there's
no better way of doing it. But I thought I would ask if anyone has any
other suggestions.


I use openGL to load animation "film strips" as textures. Animation is then just a matter of changing the texture sub-rect drawn, and animations draw just as fast as static images. It does eat up a fair amount of texture memory though, which might be a problem if you had a huge amount of animation.

-Jasper