summaryrefslogtreecommitdiffstats
path: root/top.gd
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-11-19 17:30:23 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-11-19 17:30:23 +0200
commit9ffb1eff073872df449a957c20154b9cc77f7ef7 (patch)
tree5baab0ac4382179054b9d1014bef905ac11b475c /top.gd
parent30a3c440c3f18d7d2e0d6cb2e9c41f778922ba89 (diff)
Use get_node(name) instead of get_child(n) in Top
Diffstat (limited to 'top.gd')
-rw-r--r--top.gd6
1 files changed, 4 insertions, 2 deletions
diff --git a/top.gd b/top.gd
index 943d446..9c6f483 100644
--- a/top.gd
+++ b/top.gd
@@ -8,6 +8,7 @@ var save_state = ConfigFile.new()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var room = initial_room.instantiate()
+ room.name = "active_room"
add_child(room)
# Testing
@@ -20,10 +21,11 @@ func _ready() -> void:
func change_room(room_name: String):
var room = ResourceLoader.load("res://room_" + room_name + ".tscn")
- var current_room = get_child(0)
+ var current_room = get_node("active_room")
remove_child(current_room)
- var next_room = room.instantiate()
+ var next_room: Node = room.instantiate()
+ next_room.name = "active_room"
add_child(next_room)
func save():