fixed player leaving bounds check

This commit is contained in:
derek
2025-03-25 10:27:59 -05:00
parent 2e7cc249ae
commit 3e3a0d2192
5 changed files with 23 additions and 20 deletions

View File

@@ -31,8 +31,8 @@ radius = 0.509802
height = 2.03547 height = 2.03547
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rw673"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rw673"]
radius = 0.2 radius = 0.506064
height = 0.4 height = 1.19253
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_vhypf"] [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_vhypf"]
dof_blur_amount = 0.3 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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.589976, 0)
target_position = Vector3(0, 0.9, 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="."] [node name="Head" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.889, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.889, 0)

View File

@@ -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?!"]) 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")] [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 billboard = 2
texture = SubResource("ViewportTexture_87l3v") texture = SubResource("ViewportTexture_87l3v")
character = NodePath("..") character = NodePath("..")

View File

@@ -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="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"] [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://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://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="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"]] [node name="HUB_1" type="Node3D" groups=["hub_level"]]
script = ExtResource("1_1bnbi") 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")] [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) 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"]

View File

@@ -1,13 +1,5 @@
extends Area3D 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: func _on_body_exited(body: Node3D) -> void:
if !player_exit: print("PLAYER OUT OF BOUNDS")
get_tree().current_scene.die() get_tree().current_scene.die()

View File

@@ -528,14 +528,14 @@ func punch():
func crouch(delta): func crouch(delta):
if crouched: if crouched:
crouching_collision.disabled = false #crouching_collision.disabled = false
standing_collision.disabled = true standing_collision.disabled = true
if head.position != CROUCHED_POS: if head.position != CROUCHED_POS:
head.position = lerp(head.position, CROUCHED_POS, delta * 8) head.position = lerp(head.position, CROUCHED_POS, delta * 8)
speed = CROUCH_SPEED speed = CROUCH_SPEED
else: else:
standing_collision.disabled = false standing_collision.disabled = false
crouching_collision.disabled = true #crouching_collision.disabled = true
if head.position != STAND_POS: if head.position != STAND_POS:
head.position = lerp(head.position, STAND_POS, delta * 8) head.position = lerp(head.position, STAND_POS, delta * 8)
speed = level_control.gamemode.walk_speed speed = level_control.gamemode.walk_speed