getSpriteAnimFrame()
Purpose
Get the current frame in an animated sprite
Description
Find the number of the current frame in an animated sprite
Syntax
frame = getSpriteAnimFrame( sprite )
Arguments
sprite handle of the sprite
frame number of the current animation frame in the sprite
Example
image = loadImage( "Untied Games/Enemy A", false )
enemy = createSprite()
setSpriteImage( enemy, image )
setSpriteAnimation( enemy, 0, 4, 2 )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( enemy, lastpos )
setSpriteScale( enemy, { 8, 8 } )
loop
clear()
frame = getSpriteAnimFrame( enemy )
printAt( 0, 0, "Frame ", int( frame ) )
updateSprites()
drawSprites()
update()
repeat
Associated Commands
getSpriteAnimFrameCount(), getSpriteAnimSpeed(), setSpriteAnimation(), setSpriteAnimFrame(), setSpriteAnimSpeed()