ThePythonGameBook

learn Python. Create Games

User Tools

Site Tools


en:part2:pygame:step008

This is an old revision of the document!


step 008 - animation and sprite sheet

Remember the Subsurfaces from the last step ? And remember that the snake had always the same grinning facial expression ? Now, let's make some animated sprites1) - not pygame sprites, but surfaces that show different images of an animation cycle, like a bird flapping it wings.

Instead of painting all the single pictures of an animation cycle myself i prefer to use ready-made sprite sheets. In the data folder, you will find a spritesheet2) from http://www.flyingyogi.com showing several pictures of an animal.

With the help of pygame's subsurface command, i will show you how to extract single images from the sprite sheet and use them.

discussion

additional resources

source code

1)
a 2d-object moving around is referred as a Sprite_(computer_graphics)
2)
a graphic file with lot's of sprites
/var/www/horst/thepythongamebook.com/data/attic/en/part2/pygame/step008.1276586166.txt.gz · Last modified: 2014/01/09 11:07 (external edit)