Class: Animation

Graphics.Animation

Animation class

new Graphics.Animation (game, sprite, frameWidth, frameHeight, speed)

Name Type Description
game Core.Game the game object
sprite Graphics.Sprite the sprite object to apply animation to
frameWidth Number the sprite tile frame width
frameHeight Number the sprite tile frame height
speed Number the animation speed (fps)

Members

frameCounter Number

current frame

Methods

nextAnimation ()

sets current to next animation

nextFrame ()

sets current to next frame

render ()

rendering the animaion

setAnimationIndex (i)

sets the animation index (usually spritesheet row)
Name Type Description
i Number animation index

setFrameIndex (i)

sets the animation frame index.
Name Type Description
i Number animation frame index

updateFrame ()

updates the current frame