You can use FlxSprite.loadGraphic()
to load an image file and set it to be the graphic of your FlxSprite
.
// sprite's graphic will be loaded from the file 'path/to/image.png'
sprite.loadGraphic('path/to/image/png');
You can use FlxSprite.loadGraphic()
to load an image file and set it to be the graphic of your FlxSprite
.
// sprite's graphic will be loaded from the file 'path/to/image.png'
sprite.loadGraphic('path/to/image/png');
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
class PlayState extends FlxState
{
override function create()
{
super.create();
var sprite = new FlxSprite();
sprite.loadGraphic("assets/bigbox.png");
sprite.screenCenter();
add(sprite);
}
}