setSpriteRotationSpeed()
Purpose
Set a sprites rotation speed
Description
Set a sprites speed of rotation. This is the amount that the sprite rotation angle is changed by when updatesprites is called
Syntax
setSpriteRotationSpeed( sprite, rotationSpeed )
sprite.rotation_speed = rotationSpeed
Arguments
sprite handle of the created sprite
*rotationSpeedamount to add to the rotation angle of the sprite at each updatesprites call
Example
radians( true )
image = loadImage( "Untied Games/Enemy small top C", false )
ship = createSprite()
setSpriteImage( ship, image )
lastpos = { gWidth() / 2, gHeight() / 2 }
setSpriteLocation( ship, lastpos )
setSpriteScale( ship, { 10, 10 } )
rv = 0
maxrv = 30 // max rotation speed
accrv = 0.3 // accelaration
loop
clear()
c = controls( 0 )
printAt( 0, 0, "Use left joystick left or right to change rotation speed" )
rv = rv + c.lx * accrv
if abs( rv ) > maxrv then
rv = rv / abs( rv ) * maxrv
endIf
setSpriteRotationSpeed( ship, rv )
updateSprites()
drawSprites()
update()
repeat
Associated Commands
getSpriteRotation(), getSpriteRotationSpeed(), setSpriteRotation()