extends Position2D var loader = load('res://npc.tscn') var buffer = 300 func _physics_process(delta): buffer -= 1 if buffer == 0: buffer = 300 if get_child_count() < 5: print('add enemy') var instancer = loader.instance() instancer.global_position = global_position add_child(instancer) pass # Replace with function body.