From 3e3a0d219216a79e3d22ea0938eb0a8cb85e8b41 Mon Sep 17 00:00:00 2001 From: derek Date: Tue, 25 Mar 2025 10:27:59 -0500 Subject: [PATCH] fixed player leaving bounds check --- assets/player.tscn | 8 ++------ assets/spider2.tscn | 2 +- scenes/HUBWORLD.tscn | 17 ++++++++++++++++- scripts/level_bounds.gd | 12 ++---------- scripts/player.gd | 4 ++-- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/assets/player.tscn b/assets/player.tscn index 56af41d..dbc86af 100644 --- a/assets/player.tscn +++ b/assets/player.tscn @@ -31,8 +31,8 @@ radius = 0.509802 height = 2.03547 [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rw673"] -radius = 0.2 -height = 0.4 +radius = 0.506064 +height = 1.19253 [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_vhypf"] dof_blur_amount = 0.3 @@ -155,10 +155,6 @@ shape = SubResource("CapsuleShape3D_rw673") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.589976, 0) target_position = Vector3(0, 0.9, 0) -[node name="EternalCollision" type="CollisionShape3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.421329, 0) -shape = SubResource("CapsuleShape3D_rw673") - [node name="Head" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.889, 0) diff --git a/assets/spider2.tscn b/assets/spider2.tscn index 0c34147..19f80e1 100644 --- a/assets/spider2.tscn +++ b/assets/spider2.tscn @@ -1178,7 +1178,7 @@ damage_number = ExtResource("9_rmegy") taunts = Array[String](["did i do that?", "you've been on my shitlist", "you like that?? you want more??", "you should try dodging", "schwing!", "hows your gut now you big cup of dumdum juice?!"]) [node name="HealthBarSprite" parent="." node_paths=PackedStringArray("character") instance=ExtResource("7_87l3v")] -transform = Transform3D(0.254412, 0, 0, 0, 0.561068, 0, 0, 0, 1, 0, 1.95671, 0) +transform = Transform3D(0.254412, 0, 0, 0, 0.561068, 0, 0, 0, 1, 0, 2.41498, 0) billboard = 2 texture = SubResource("ViewportTexture_87l3v") character = NodePath("..") diff --git a/scenes/HUBWORLD.tscn b/scenes/HUBWORLD.tscn index 35f36c9..bad4eed 100644 --- a/scenes/HUBWORLD.tscn +++ b/scenes/HUBWORLD.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://jdwpc622vmok"] +[gd_scene load_steps=22 format=3 uid="uid://jdwpc622vmok"] [ext_resource type="Script" uid="uid://bkii8jwf0k7tq" path="res://scripts/LevelManager.gd" id="1_1bnbi"] [ext_resource type="Resource" uid="uid://bxcxqt7rmfvdw" path="res://GameModes/hubworld.tres" id="2_62iy8"] @@ -19,6 +19,10 @@ [ext_resource type="PackedScene" uid="uid://c67yfijknmx2m" path="res://assets/revolver2_pickup.tscn" id="16_ipgnf"] [ext_resource type="PackedScene" uid="uid://dyu46bns8mesv" path="res://assets/mac10_pickup.tscn" id="17_u30rd"] [ext_resource type="PackedScene" uid="uid://c1xw80jkg3reb" path="res://assets/target_1.tscn" id="19_sx5wx"] +[ext_resource type="Script" uid="uid://bdxonkxnmxe6n" path="res://scripts/level_bounds.gd" id="20_vf4a6"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_141ag"] +size = Vector3(80, 80, 80) [node name="HUB_1" type="Node3D" groups=["hub_level"]] script = ExtResource("1_1bnbi") @@ -251,3 +255,14 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.4249, 3.22414, 9.56468) [node name="TARGET 2" parent="." instance=ExtResource("19_sx5wx")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.09968, 3.22414, -6.79385) + +[node name="LEVEL BOUNDS" type="Area3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -18.8287, 0) +collision_layer = 4 +collision_mask = 4 +script = ExtResource("20_vf4a6") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="LEVEL BOUNDS"] +shape = SubResource("BoxShape3D_141ag") + +[connection signal="body_exited" from="LEVEL BOUNDS" to="LEVEL BOUNDS" method="_on_body_exited"] diff --git a/scripts/level_bounds.gd b/scripts/level_bounds.gd index e743d27..f4352c6 100644 --- a/scripts/level_bounds.gd +++ b/scripts/level_bounds.gd @@ -1,13 +1,5 @@ extends Area3D -var player_exit = false - -func _ready() -> void: - SignalBus.player_exiting_tree.connect(player_exit_check) - -func player_exit_check(): - player_exit = true - func _on_body_exited(body: Node3D) -> void: - if !player_exit: - get_tree().current_scene.die() + print("PLAYER OUT OF BOUNDS") + get_tree().current_scene.die() diff --git a/scripts/player.gd b/scripts/player.gd index f090c3d..34f9e83 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -528,14 +528,14 @@ func punch(): func crouch(delta): if crouched: - crouching_collision.disabled = false + #crouching_collision.disabled = false standing_collision.disabled = true if head.position != CROUCHED_POS: head.position = lerp(head.position, CROUCHED_POS, delta * 8) speed = CROUCH_SPEED else: standing_collision.disabled = false - crouching_collision.disabled = true + #crouching_collision.disabled = true if head.position != STAND_POS: head.position = lerp(head.position, STAND_POS, delta * 8) speed = level_control.gamemode.walk_speed