Simple Animation
From CodeStuff
Revision as of 01:27, 31 January 2012 by Lerc (Talk | contribs) (moved Simple animation to Simple Animation)
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.