deltaTime()
Purpose
Get the time difference between frames
Description
Time difference between the current frame and the previous frame, in seconds
Syntax
deltatime = deltaTime( )
Arguments
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()
// updateSprite(enemy[0]) not updated
updateSprite( enemy[1] ) // normal speed
updateSprite( enemy[2], deltaTime() / 2 ) // half speed
updateSprite( enemy[3], deltaTime() * 2 ) // double speed
drawSprites()
update()
repeat
Associated Commands
createSprite(), drawSprite(), drawSprites(), removeSprite(), updateSprites(), updateSprite()