Wednesday, August 8, 2012

python 2.7 : pygame 1.9.1 : animating an image in pygame

This is an example of animating an image using pygame:

image.py



Theese lines import the sys and pygame modules if you have python and the compatible pygame installed:

The following lines of code initializes curicial game variables and set prefferences for our loaded images such as replacing a specified color with zero opacity:

the main loop of the game handles animation and refreshing the screen:

No comments:

Post a Comment