Create a new scene with CanvasLayer as the root node
Save the scene as hud.tscn
Think of a CanvasLayer as a clear sheet of glass laid right over the top of your game screen.
Normally, every 2D node in your scene lives in the same shared world space—if a giant asteroid drifts across the middle of the screen, or if a camera pans away, standard nodes move with the world or can get covered up by gameplay objects.
Placing your UI nodes (like your Play button, score labels, and health bars) inside a CanvasLayer solves two major problems automatically:
Always on Top: By default, a CanvasLayer renders on layer 1 (above your main game world on layer 0). No matter how many lasers, explosions, or space rocks fill the screen, your menu and HUD will always draw cleanly on top of the action.
Locked to the Screen: A CanvasLayer ignores your game world's position and camera movement. Even if you add a scrolling camera or screen-shake later, anything inside the CanvasLayer stays pinned to the exact same spot on the player's monitor.
Add a Timer and MarginContainer as children
Select the MarginContainer
Set the Anchor to Top Wide
In Theme Overrides set margins to 20
Add an HBoxContainer as a child of MarginContainer
This will position the score on the left
And the lives on the right
As children of HBoxContainer add
A Label renamed to ScoreLabel
another HBoxContainer renamed to LivesCounter
Set Horizontal size to Expand
Add a TextureRect as a child of LivesCounter
Set player_small.png as the Texture
Set Stretch Mode to Keep Aspect Centered
Select the L1 node and duplicate it twice
We will hide and show these nodes
To display the number of player lives
Add a VBoxContainer as a child of HUD
Inside the VBox add a Label named Message
Add a TextureButton named StartButton
Set the Layout of VBoxContainer to Center Wide
In Theme Overrides set Separation to 100
Use play_button.png for the Normal Texture
Use play_button_h.png for Hover Texture
Set Horizontal size to Shrink Center
Set Horizontal Alignment to Center