Layout
Godot's Control nodes include a number of specialized containers. These nodes can be nested inside each other to create the precise layout you need. For example, a MarginContainer will automatically add padding around its contents, while HBoxContainer and VBoxContainer organize their contents in rows or columns, respectively.
Start by adding a MarginContainer, which will hold the score and lives counter. Under the Layout menu, select Top Wide. Then, scroll down to the Custom Constants section and set all four margins to 20.
Next, add an HBoxContainer, which will hold the score counter on the left and the lives counter on the right. Under this container, add a Label (name it ScoreLabel) and another HBoxContainer (name it LivesCounter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access