We're going to start by adding a background, and two text fields to display the score and game time to the player. Open up
PlayState.hx, and we'll add some variables.
Inside the class, add the following variables:
private var background:FlxSprite; private var txtScore:FlxText; private var txtTime:FlxText;
The background is a
FlxSprite object. It is used when you want to display an art asset or a shape drawn by HaxeFlixel. The
txtTime variables are
FlxText objects, and as the name implies, they're used to display text.
After this, go inside the
create function and add the following underneath
background = new FlxSprite(); background.loadGraphic(AssetPaths.gameBackground__png); add(background); ...