Create a new scene with CanvasLayer Node as root
Why Use a CanvasLayer for Your HUD / Score? (In Plain English)
Think of a CanvasLayer as a clear sheet of glass taped directly onto your monitor, hovering above your actual game world.
Construct 3 Equivalent: It is Godot's version of a dedicated "HUD" Layer with Parallax set to 0%, 0%, so whatever you place on it stays glued to the corners of the screen.
Stays Pinned When the Camera Moves: If you ever add a Camera2D that follows the Wizard around a bigger map, zooms in, or shakes during an explosion, normal UI nodes would get left behind in the level. Anything inside a CanvasLayer stays locked to the screen.
Always Draws on Top: Because it sits on its own higher layer (Layer 1 by default, above the game world on Layer 0), Goblins, spells, and spark flashes can never accidentally overlap or cover up your score text.
Add a MarginContainer as a child
Set its Anchor Preset to Top Left
Select the MarginContainer
Set Margin Left and Margin Top to 16px
Add a Label as a child of MarginContainer
Set Text property to Score: 0
Set Outline Size to 10 px
Set Outline Color to Black
Save your scene as hud.tscn
Add an instance of the scene to
Attach a script to the hud node
Add a reference variable for the score label
Add a function to update the score
Return to the Goblin Script
Update the take damage function
To emit the died signal when
Return to the main_level script
Add a variable to hold the score
Add a reference to the HUD node
Add a goblin died function
Update the timeout function
To connect the goblin died signal
CONGRATS ON COMPLETING THE TUTORIAL!