You can set the angle
of a FlxObject
to rotate it. By default, angle is 0
, which is to the right.
// sprite's angle will be set to 90 (down)
sprite.angle = 90;
You can set the angle
of a FlxObject
to rotate it. By default, angle is 0
, which is to the right.
// sprite's angle will be set to 90 (down)
sprite.angle = 90;
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
class PlayState extends FlxState
{
var sprite:FlxSprite;
override function create()
{
super.create();
sprite = new FlxSprite("assets/arrow.png");
sprite.screenCenter();
add(sprite);
}
override function update(elapsed:Float)
{
super.update(elapsed);
sprite.angle += elapsed * 30;
}
}