made a rat and a ladder and the rat is *kind* of working

This commit is contained in:
Derek
2024-07-27 21:08:41 -05:00
parent 94ddefc7f5
commit 186aa89e3f
39 changed files with 5191 additions and 46 deletions

36
scripts/Rat_Control.gd Normal file
View File

@@ -0,0 +1,36 @@
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