rat holes are kiiiiinda working
This commit is contained in:
@@ -16,6 +16,9 @@ var particle_number = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
#global randomize function
|
||||
randomize()
|
||||
|
||||
#Set up starting guns and ammo
|
||||
held_guns = [gun_1]
|
||||
var instance_gun = held_guns[0].instantiate()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -13,9 +13,9 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if end_hole != null:
|
||||
var move_direction = end_hole.global_position - self.position
|
||||
self.set_linear_velocity(move_direction * 1)
|
||||
#self.look_at(end_hole.position,Vector3.UP)
|
||||
var move_direction = (end_hole.global_position - self.position).normalized()
|
||||
position += transform.basis * move_direction * delta * 7
|
||||
self.look_at(end_hole.position,Vector3.UP)
|
||||
|
||||
func breaking(bullet_velocity):
|
||||
var spawn_broken = dead_rat.instantiate()
|
||||
|
||||
Reference in New Issue
Block a user