Menu
CoddyTech

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 icon

Challenge

Easy

Put the score on the screen.

  1. In _ready(), set the text of $HUD/Score.
  2. 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

Practice on your own: Godot playground