CHALLENGE 1: A Score Label That Updates ==================================================================== TASK ---- Build a CanvasLayer containing a Label anchored to the top-left corner. Write a script with a score variable starting at 0, a function that adds 10 to it and updates the Label's text to "Score: X", and call that function a few times from _ready() to confirm it updates correctly. SCENE STRUCTURE ---------------- Root (Node2D) |-- HUD (CanvasLayer) |-- ScoreLabel (Label) <- Layout menu > Anchor Presets > Top Left SOLUTION CODE (attached to ScoreLabel) ------------------------------------------- extends Label var score: int = 0 func _ready() -> void: _update_label() add_score() add_score() add_score() func add_score() -> void: score += 10 _update_label() func _update_label() -> void: text = "Score: " + str(score) OUTPUT (visible in the running scene's top-left corner, updating live) --------------------------------------------------------------------------- Score: 0 (briefly, on the very first frame) Score: 10 Score: 20 Score: 30 (the final, visible state) WHY THIS WORKS AS AN ANSWER ---------------------------- Anchoring the Label to "Top Left" via the Layout menu's preset guarantees it sits in the same screen corner regardless of window size, matching the chapter's own guidance to prefer a preset over manually dragging a Control into position. add_score() does two things every time it's called: increments the score variable by 10, then calls the shared _update_label() helper, which sets this Label's own text property directly (since the script extends Label, text is already available with no $-lookup needed - the same pattern Chapter 4 used for a script extending Sprite2D directly). Separating the "change the data" step from the "refresh what's displayed" step into two small functions, rather than repeating the text = "Score: " + str(score) line inside add_score() itself, keeps the display-update logic in exactly one place - useful the moment a second way to change score (a bonus, a penalty) is added later.