updateSprites()
Purpose
Process speed additions for all sprites
Description
Adds the current speed values to the position, rotation and colour of all sprites causing them to move, rotate or change colour when drawn.
Syntax
updateSprites( )
updateSprites( sprites )
updateSprites( deltatime )
updateSprites( sprites, deltatime )
Arguments
sprites array of sprites to be updated
deltatime time difference between the current frame and the previous frame, in seconds
Example
image = loadImage( "Untied Games/Enemy A", false )
enemy = []
for i = 0 to 4 loop
enemy[i] = createSprite( )
setSpriteImage( enemy[i], image )
setSpriteAnimation( enemy[i], 0, 4, 20 )
setSpriteLocation( enemy[i], { ( i % 2 ) * 400 + 400, int( i / 2 ) * 300 + 200 } )
setSpriteScale( enemy[i], { 4, 4 } )
repeat
loop
clear()
printAt( 0, 0, "Press X for normal speed" )
printAt( 0, 1, "Press A for half speed" )
printAt( 0, 2, "Press B for double speed" )
c = controls( 0 )
if c.x then
updateSprites()
endIf
if c.a then
updateSprites( enemy, deltaTime() / 2 )
endIf
if c.b then
updateSprites( enemy, deltaTime() * 2 )
endIf
drawSprites()
update()
repeat
Associated Commands
createSprite(), deltaTime(), drawSprite(), drawSprites(), removeSprite(), updateSprites(), updateSprite()