getSpriteAnimSpeed()
Purpose
Find the speed of a sprites animation
Description
Get the current speed of animation of a sprite
Syntax
speed = getSpriteAnimSpeed( sprite )
speed = sprite.anim_speed
Arguments
sprite The handle of the sprite
speed The speed of the animation
Example
image = loadImage( "Untied Games/Enemy A", false )
enemy = createSprite()
setSpriteImage( enemy, image )
speed = 0
maxspeed = 50
setSpriteAnimation( enemy, 0, 4, speed )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( enemy, lastpos )
setSpriteScale( enemy, { 8, 8 } )
loop
clear()
printAt( 0, 0, "Use left joystick to control animation speed" )
c = controls( 0 )
speed = getSpriteAnimSpeed( enemy )
if abs( speed + c.lx ) < maxspeed then
setSpriteAnimSpeed( enemy, speed + c.lx )
endIf
updateSprites()
drawSprites()
update()
repeat
Associated Commands
getSpriteAnimFrame(), getSpriteAnimFrameCount(), setSpriteAnimation(), setSpriteAnimFrame(), setSpriteAnimSpeed()