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

Re: [pygame] kind of animation



DR0ID wrote:
I wonder in wich way you do your animations. As said, I think framebased is the simplest thing to do, but perhaps not the best. And perhaps there are other ways to do animation!? There is also the other question: how to store the images for the animation. A list of images? Or one big image strip and then only changing the source rect? Or a list of sprites? What if an object uses 4 different animations? Use 4 lists in a dict? Or a list of animation-objects? Or an 2D-image strip and move the source rect?

My animation code isn't complete yet, but what I did was put all the frames in a single image file, then calculate a set of rectangles representing where each frame is. Then I can blit just that rectangle from the larger image. (I have that part down.) Animation would work by naming a sequence, eg. "walk_east = [3,4,5]" and using that sequence to determine what frames get displayed.


Kris