CHALLENGE 2: Instancing Three Copies of a Scene ==================================================================== TASK ---- Save a simple scene (e.g. a single Node2D) as its own .tscn file. From a different script, preload it, instantiate three copies with .instantiate(), and add_child() each one at a different position so all three appear in the running scene. SETUP ----- 1. Create a new scene with a single Node2D root (optionally add a Sprite2D child so each copy is actually visible). Save it as "res://marker.tscn". 2. In your main scene, attach this script to the root node. SOLUTION CODE ------------- extends Node2D const MarkerScene: PackedScene = preload("res://marker.tscn") func _ready() -> void: _spawn_marker(Vector2(0, 0)) _spawn_marker(Vector2(100, 0)) _spawn_marker(Vector2(200, 0)) func _spawn_marker(pos: Vector2) -> void: var marker = MarkerScene.instantiate() add_child(marker) marker.position = pos WHY THIS WORKS AS AN ANSWER ---------------------------- preload("res://marker.tscn") loads the scene's own blueprint (a PackedScene) exactly once, at compile time, since the path is a fixed string known in advance - this matches the chapter's own guidance to prefer preload() over load() whenever the path doesn't need to be built dynamically. Each call to MarkerScene.instantiate() creates a brand-new, fully independent Node2D from that same blueprint - calling it three times produces three separate node instances, not three references to the same node. add_child(marker) is what actually attaches each new node into the running scene tree; without it, an instantiated node exists in memory but is never actually part of the visible game, exactly as the chapter describes. Setting marker.position after adding it places each of the three copies at a different spot on screen, which is what proves there really are three separate instances and not one node being moved around three times.