extends Node2D class_name NpcFactory @export var NPC_SCENE: PackedScene @export var SPAWN_DELAY: float = 0.5 var current_spawn_duration = 0 func _ready(): if !NPC_SCENE: push_error("npc scene is null") set_physics_process(false) func _physics_process(delta): current_spawn_duration += delta if current_spawn_duration > SPAWN_DELAY: current_spawn_duration = 0 var npc = NPC_SCENE.instantiate() add_child(npc)