Game Development Reference
In-Depth Information
Expanding the HUD
Now, we need to add the rest of the HUD to show the ongoing score and other information
we need to give the player. In most cases, it is best to have the HUD as its own layer. Add a
new layer and name it
HUD
.
Create a new textbox and move it to the bottom-left corner. Make sure it is outside the
game area.
Tip
The current size and color of the text isn't great. I'd advise you to change the text to make it
bigger, and also change the color to white from the
Properties
panel.
Change the name of the textbox to
HUDscore
, and then add a
HUDscore
action to the
On every tick
event. We're going to add a
Set text
action to
HUDscore
. Set the text to
"Score: "&Score
. This will mean that the HUD textbox will read
Score:
, which we
wrote in the quotation marks, and then it will print the exact variable score achieved from
destroy goalBalls
. Make sure you insert a space after the colon of
"Score: "
;
otherwise, one won't appear in the game.
Note
In order to print variables, you need the
&
symbol.