A Label on Screen
Part of the Game Rules section of Coddy's Godot journey. Lesson 6 of 29.
A Label node shows text on the screen. Set its text to change what it shows:
$Message.text = "Hello!"Game labels go in a CanvasLayer. It is drawn on top of the game and stays fixed on the screen, even when a camera moves.
Open the Scene tab. This room has a CanvasLayer called HUD (heads up display). It holds an empty Label called Score in the top left corner. Its path from Main is HUD/Score.
Challenge
EasyPut the score on the screen.
- In
_ready(), set thetextof$HUD/Score. - Make it
Score: 0.
Press Play: Score: 0 shows in the corner. Then Check.
Try it yourself
extends Node2D
func _ready():
pass
All lessons in Game Rules
2Score on Screen
A Label on ScreenNumbers into TextFormat with PercentUpdate the LabelA Clock on ScreenPractice on your own: Godot playground