The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

Pyganim - A Pygame module to make sprite animation dead simple.

Fri 09 December 2011    Al Sweigart

Pyganim logo

Download pyganim.py and example programs. (Works on both Python 2 and 3.)

Details at http://inventwithpython.com/pyganim/

Pyganim is a module that you can import into your Pygame games to handle sprite animation. Creating an animation is simply a matter of supplying a list of image filenames (or pygame.Surface objects) for each frame of animation, along with the duration that each frame lasts. Then call the play() method to start the animation and then call blit() each time you draw the window. The blit() function automatically draws the correct frame based on the amount of real time that has passed since the play() method was called. There are many, many other methods to provide finer levels of control as well.

There is more information available on the Tutorial and Reference page.


Learn to program for free with my books for beginners:

Sign up for my "Automate the Boring Stuff with Python" online course with this discount link.

Email | Mastodon | Twitter | Twitch | YouTube | GitHub | Blog | Patreon | LinkedIn | Personal Site