O'Reilly logo

Haxe Game Development Essentials by Jeremy McCurdy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the new game HUD

Now we're going to implement the new game HUD. This will display a series of hearts that indicate player health and show the player's score. Since we haven't fleshed out the rest of the gameplay, the health display won't do anything yet, but it will be ready for when we take care of that in the next chapter.

Creating the GameHUD class

To start, we're going to create a new class in the source/ui folder as we did with LevelEndScreen. So, make a class named GameHUD. This class will extend the FlxGroup class this time around.

For Sublime Text users, here's what the class should look like to start:

package ui;

import flixel.group.FlxGroup;

class GameHUD extends FlxGroup
{
  public function new() 
  {
    super();
  }
}

Adding imports

Now that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required