extends Node2D @export var scene_to_spawn : PackedScene var spawned_scene # Called when the node enters the scene tree for the first time. func _ready() -> void: $SpawnTimer.timeout.connect(_on_spawn_timeout) $Sprite2D.hide() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta: float) -> void: pass func _on_spawn_timeout(): if spawned_scene: return spawned_scene = scene_to_spawn.instantiate() spawned_scene.position = position get_tree().root.add_child(spawned_scene)