This commit is contained in:
2025-01-17 21:47:13 +01:00
parent 83702d5a75
commit ad3c8766c3
4 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
extends Node
@export var first_scene :PackedScene = null
signal change_scene_signal(new_scene: PackedScene)
var current_scene:Node = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
change_scene_signal.connect(change_scene_func)
emit_signal("change_scene_signal", first_scene)
func change_scene_func(scene: PackedScene) -> void:
if current_scene != null:
current_scene.queue_free()
current_scene = scene.instantiate()
add_child(current_scene)

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://uo5bppg214ci"]
[ext_resource type="Script" path="res://scene/scene_manager/scene_manager.gd" id="1_qulgr"]
[ext_resource type="PackedScene" uid="uid://brc445tt624lb" path="res://scene/walk_zone.tscn" id="2_elo70"]
[node name="scene_manager" type="Node"]
script = ExtResource("1_qulgr")
first_scene = ExtResource("2_elo70")