Introduction

In this chapter I have gone over the UI elements such as health bars of the character’s, selection grid and gave you some useful information about other things such as texture, and text drawings, and adding font to your project. Firstly we will create a new class ARTSBR_HUD from Unreal’s AHUD class.

Before starting I recommend you to look at the following changes of our codes:

Health Bars

Let’s start doing our HUD with the health bars. The bars can be drawn as actors in the world space facing to the camera, but we will do it in much simpler way. The health bars will be drawn in the UI space and the actual world has nothing to do with them.

We will show all the characters on the map for now, but it can be changed in the future with a line change in the code. I am certainly not sure if we should show all the characters including enemies, only our characters, or only the selected characters. However, as I said we can change it in the future with only a single line change. Let’s decide it when we will have different teams in the game! 🙂

Selection Grid

If the selection operation is started we will draw the selection grid in our UI. For the selection grid we will draw a rectangular and a line surrounding it.

 

Top Information Bar

Actually this part is not essential at the moment, but I wanted to show how to draw textures and texts with C++. We will also import a font and use it.  You can download the font here.

Before importing the font

When you want to import the font into Unreal Engine, it gives you the following warning. Click yes to make it create its asset. Without the asset we cannot really use it in our project since the engine does not support regular fonts as they are, it must create its font asset itself.

After importing the font

Result