extends Node3D @export var rat : Resource @export var spawn_amount = 1 #max amount in level at any given time var rng = RandomNumberGenerator.new() var holes = [] var start_hole_id var start_hole var end_hole_id var end_hole var hole_length_id var control_node = self # Called when the node enters the scene tree for the first time. func _ready(): holes = get_children() hole_length_id = holes.size() - 1 # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): if spawn_amount > 0: #assign holes #start_hole_id = rng.randi_range(0,hole_length_id) #end_hole_id = rng.randi_range(0,hole_length_id) #make sure the end hole doesn't equal the start hole #if end_hole_id != start_hole_id: #assign objects start_hole = holes[0] end_hole = holes[1] #spawn rat at first hole and pass position of next hole start_hole.spawn_rat(end_hole,control_node) spawn_amount -= 1