The SpriteAnimation class
Contains the primitives to play animations using a sprite sheet.
Parameter
start
First frame of the animation
length
The length of the animation. The last frame shown is (start + length)
delay
The delay between frames in milliseconds
looping
A boolean which contains whether or not too loop the animation.
currentFrame
the current frame
lastTime
The last time the frame got switched. DO NOT MODIFY!
SpriteAnimation(start,length,delay,looping)
Create a SpriteAnimation object.
Parameter
start
The first frame of the animation in the sprite sheet.
length
The length of the animation in frames.
delay
The delay between frames in milliseconds.
looping
A boolean specifying if the animation should loop after finishing.
function SpriteAnimation:nextFrame()
Calculates the next frame in the animation
and returns the new frame number in the sprite sheet as a number.
Return: The next frame number.