rat holes are kiiiiinda working

This commit is contained in:
Derek
2024-07-28 00:36:42 -05:00
parent 186aa89e3f
commit e324ce829a
6 changed files with 56 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
extends Node3D
@export var rat : Resource
@export var spawn_amount = 1 #max amount in level at any given time
@export var spawn_amount = 10 #max amount in level at any given time
var rng = RandomNumberGenerator.new()
var holes = []
@@ -21,15 +21,13 @@ func _ready():
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]
start_hole_id = rng.randi_range(0,hole_length_id)
start_hole = holes[start_hole_id]
end_hole_id = rng.randi_range(0,hole_length_id)
while start_hole_id == end_hole_id:
end_hole_id = rng.randi_range(0,hole_length_id)
end_hole = holes[end_hole_id]
#spawn rat at first hole and pass position of next hole
start_hole.spawn_rat(end_hole,control_node)