setSpriteAnimSpeed()
Purpose
Change the speed of a sprites animation
Description
Speed up or slow down the speed of animation of a sprite
Syntax
setSpriteAnimSpeed( sprite, speed )
sprite.anim_speed = speed
Arguments
sprite handle of the sprite
speed speed of the animation
Example
image = loadImage( "Untied Games/Enemy A", false )
enemy = createsprite()
setSpriteImage( enemy, image )
setSpriteAnimation( enemy, 0, 4, 0 )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( enemy, lastpos )
setSpriteScale( enemy, { 8, 8 } )
loop
clear()
c = controls( 0 )
printAt( 0, 0, "Use left joystick to control animation speed" )
setSpriteAnimSpeed( enemy, c.lx * 30 )
updateSprites()
drawSprites()
update()
repeat
Associated Commands
getSpriteAnimFrame(), getSpriteAnimFrameCount(), getSpriteAnimSpeed(), setSpriteAnimation(), setSpriteAnimFrame()