made a rat and a ladder and the rat is *kind* of working
This commit is contained in:
36
scripts/Rat_Control.gd
Normal file
36
scripts/Rat_Control.gd
Normal 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
|
||||
Reference in New Issue
Block a user