angularVelocity
sets a FlxObject
to rotate at a steady speed in degrees per second.
// sprite will spin 30 degrees/s, clockwise
sprite.angularVelocity = 30;
angularVelocity
sets a FlxObject
to rotate at a steady speed in degrees per second.
// sprite will spin 30 degrees/s, clockwise
sprite.angularVelocity = 30;
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
class PlayState extends FlxState
{
var sprite:FlxSprite;
var timer:Float = 0;
var speed:Int = 1;
override function create()
{
super.create();
sprite = new FlxSprite("assets/arrow.png");
sprite.screenCenter();
add(sprite);
sprite.angularVelocity = 30;
}
override function update(elapsed:Float)
{
timer += elapsed;
if (timer >= 2)
{
timer = 0;
speed++;
if (speed >= 8)
speed = 1;
sprite.angularVelocity = speed * 100;
}
super.update(elapsed);
}
}