Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Godot Engine Game Development Projects

You're reading from   Godot Engine Game Development Projects Build five cross-platform 2D and 3D games with Godot 3.0

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788831505
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Chris Bradfield Chris Bradfield
Author Profile Icon Chris Bradfield
Chris Bradfield
Arrow right icon
View More author details
Toc

HUD

The purpose of the HUD is to display the information the player needs to know during gameplay. Collecting items will increase the player's score, so that information needs to be displayed. The player also needs to see their remaining life value, which will be displayed as a series of hearts.

Scene setup

Create a new scene with a MarginContainer node. Name it HUD and save in the ui folder. Set the Layout to Top Wide. In the Custom Constants section of Inspector, set the following values:

  • Margin Right: 50
  • Margin Top: 20
  • Margin Left: 50
  • Margin Bottom: 20

Add an HBoxContainer. This node will contain all the UI elements and keep them aligned. It will have two children:

  • Label: ScoreLabel
  • HBoxContainer: LifeCounter
...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime