Difference between revisions of "Simple Animation"

From CodeStuff
Jump to: navigation, search
(Created page with "When loading an image, you have the option of specifying if there are multiple frames of animation in the image. Often animations will be stored in a single image as a horizo...")
 
 
(No difference)

Latest revision as of 01:27, 31 January 2012

When loading an image, you have the option of specifying if there are multiple frames of animation in the image. Often animations will be stored in a single image as a horizontal or vertical strip or even arrayed in a grid.

The loadImage function lets you specify how many frames across and down there are in an image.

In this example loadImage("Gus_Running_Left_Small.png",1,18); says that the image should be treated as an animation 1 frame wide and 18 frames high. The drawImage has an extra parameter to say which frame of animation to use.


Gus Running Left Small.png
Gus Running Right Small.png