diff --git a/assets/rat.tscn b/assets/rat.tscn index 2e55369..1fa5c2c 100644 --- a/assets/rat.tscn +++ b/assets/rat.tscn @@ -374,7 +374,6 @@ skeleton = NodePath("") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.107148, 0.0793237, 0) -visible = false shape = SubResource("ConvexPolygonShape3D_7py8o") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] diff --git a/assets/rat_dead.tscn b/assets/rat_dead.tscn index c10f58f..02b80d4 100644 --- a/assets/rat_dead.tscn +++ b/assets/rat_dead.tscn @@ -2228,6 +2228,7 @@ points = PackedVector3Array(-0.00948123, 0.000167692, -0.036668, -0.00821897, 0. script = ExtResource("1_gptlv") [node name="ratdead1" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2241,6 +2242,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.230321, 0.0261679, -0.06901 shape = SubResource("ConvexPolygonShape3D_toh7u") [node name="ratdead2" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2254,6 +2256,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.22021, 0.10255, 0.0161117) shape = SubResource("ConvexPolygonShape3D_m2olr") [node name="ratdead3" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2267,6 +2270,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.395302, 0.00523825, -0.054 shape = SubResource("ConvexPolygonShape3D_dwhor") [node name="ratdead4" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2280,6 +2284,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.340264, 0.0448121, -0.0724 shape = SubResource("ConvexPolygonShape3D_w2tl3") [node name="ratdead5" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2293,6 +2298,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.281047, 0.0152403, 0.02251 shape = SubResource("ConvexPolygonShape3D_bvnff") [node name="ratdead6" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2306,6 +2312,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.460879, 0.0158354, 0.01523 shape = SubResource("ConvexPolygonShape3D_gi4s6") [node name="ratdead7" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2319,6 +2326,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23894, -0.0598621, -0.0808 shape = SubResource("ConvexPolygonShape3D_p2f5a") [node name="ratdead8" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2332,6 +2340,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.247736, -0.0613424, 0.0952 shape = SubResource("ConvexPolygonShape3D_fry47") [node name="ratdead9" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2345,6 +2354,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.510932, 0.0201625, -0.0005 shape = SubResource("ConvexPolygonShape3D_4jwed") [node name="ratdead10" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2358,6 +2368,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.166132, 0.0182415, -0.0460 shape = SubResource("ConvexPolygonShape3D_8ql87") [node name="ratdead11" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2371,6 +2382,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.458201, 0.0807596, 0.01992 shape = SubResource("ConvexPolygonShape3D_jftwc") [node name="ratdead12" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2384,6 +2396,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.417053, 0.171161, 0.017364 shape = SubResource("ConvexPolygonShape3D_nwn6d") [node name="ratdead13" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2397,6 +2410,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.257304, -0.00662706, 0.071 shape = SubResource("ConvexPolygonShape3D_anc1u") [node name="ratdead14" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2410,6 +2424,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.243598, 0.192491, -0.00274 shape = SubResource("ConvexPolygonShape3D_ps2mt") [node name="ratdead15" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2423,6 +2438,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.173917, -0.00751139, 0.0604 shape = SubResource("ConvexPolygonShape3D_jqeh6") [node name="ratdead16" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2436,6 +2452,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.203021, 0.0196445, 0.08508 shape = SubResource("ConvexPolygonShape3D_p6i2t") [node name="ratdead17" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2449,6 +2466,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.410067, 0.142113, -0.05946 shape = SubResource("ConvexPolygonShape3D_piem8") [node name="ratdead18" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2462,6 +2480,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.127862, -0.0154883, -0.084 shape = SubResource("ConvexPolygonShape3D_qeiit") [node name="ratdead19" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2475,6 +2494,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0393621, 0.0730442, -0.0103 shape = SubResource("ConvexPolygonShape3D_agpyf") [node name="ratdead20" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2488,6 +2508,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0557878, 0.0264691, -0.0960 shape = SubResource("ConvexPolygonShape3D_flowr") [node name="ratdead21" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2501,6 +2522,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.429056, 0.04264, -0.037444 shape = SubResource("ConvexPolygonShape3D_44r05") [node name="ratdead22" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2514,6 +2536,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.36518, 0.0306166, 0.048801 shape = SubResource("ConvexPolygonShape3D_l42oa") [node name="ratdead23" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2527,6 +2550,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.564917, 0.00242129, 0.00014 shape = SubResource("ConvexPolygonShape3D_oq2uw") [node name="ratdead24" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2540,6 +2564,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.400621, -0.00375759, -0.00 shape = SubResource("ConvexPolygonShape3D_3h2ke") [node name="ratdead25" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2553,6 +2578,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0916565, 0.056734, 0.07652 shape = SubResource("ConvexPolygonShape3D_rbxct") [node name="ratdead26" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2566,6 +2592,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.192625, -0.0584416, -0.0841 shape = SubResource("ConvexPolygonShape3D_fmrcm") [node name="ratdead27" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2579,6 +2606,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.235984, -0.0142865, -0.081 shape = SubResource("ConvexPolygonShape3D_2u5qm") [node name="ratdead28" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2592,6 +2620,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.238652, -0.0049432, 0.0935 shape = SubResource("ConvexPolygonShape3D_cj7xg") [node name="ratdead29" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2605,6 +2634,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.247644, -0.0610617, 0.0686 shape = SubResource("ConvexPolygonShape3D_mwvcl") [node name="ratdead30" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2618,6 +2648,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.147642, -0.0593533, 0.09954 shape = SubResource("ConvexPolygonShape3D_pa5f3") [node name="ratdead31" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2631,6 +2662,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.192549, -0.0587205, 0.0827 shape = SubResource("ConvexPolygonShape3D_im4p1") [node name="ratdead32" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2644,6 +2676,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.18745, -0.0593926, -0.0897 shape = SubResource("ConvexPolygonShape3D_n1qua") [node name="ratdead33" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2657,6 +2690,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.141863, -0.0580349, -0.0511 shape = SubResource("ConvexPolygonShape3D_hydlk") [node name="ratdead34" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 @@ -2670,6 +2704,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0548388, -0.0635261, 0.0956 shape = SubResource("ConvexPolygonShape3D_gb0w5") [node name="ratdead35" type="RigidBody3D" parent="." groups=["scene_rigidbody"]] +transform = Transform3D(-0.00541045, 0, -0.999985, 0, 1, 0, 0.999985, 0, -0.00541045, 0, 0, 0) collision_layer = 2 collision_mask = 7 diff --git a/scenes/test_level_2v2.tscn b/scenes/test_level_2v2.tscn index add7a79..6785039 100644 --- a/scenes/test_level_2v2.tscn +++ b/scenes/test_level_2v2.tscn @@ -1480,4 +1480,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0417337, -0.133987) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -25.9553, 0.0330879, -30.573) [node name="RatHole3" parent="RATS" instance=ExtResource("34_uuf6k")] -transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -17.9345, -0.015456, -30.6857) +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -17.9345, -0.015456, -30.5149) + +[node name="RatHole4" parent="RATS" instance=ExtResource("34_uuf6k")] +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -22.0695, -0.015456, -30.5149) + +[node name="RatHole5" parent="RATS" instance=ExtResource("34_uuf6k")] +transform = Transform3D(0.541195, 0, -0.840897, 0, 1, 0, 0.840897, 0, 0.541195, -59.4829, -0.0154541, -2.20793) diff --git a/scripts/LevelManager.gd b/scripts/LevelManager.gd index 83638e8..e642663 100644 --- a/scripts/LevelManager.gd +++ b/scripts/LevelManager.gd @@ -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() diff --git a/scripts/Rat_Control.gd b/scripts/Rat_Control.gd index 7823ea0..e063b7e 100644 --- a/scripts/Rat_Control.gd +++ b/scripts/Rat_Control.gd @@ -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) diff --git a/scripts/rat.gd b/scripts/rat.gd index cd26469..e71d071 100644 --- a/scripts/rat.gd +++ b/scripts/rat.gd @@ -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()