level bounds now don't error out on save/quit

This commit is contained in:
Derek
2025-04-04 08:21:46 -05:00
parent 32b9efbd92
commit 6cd06193b5
6 changed files with 22 additions and 14 deletions

View File

@@ -5,6 +5,8 @@ var level_collision_shapes : Array[CollisionShape3D]
var check_collision = true
func _ready() -> void:
SignalBus.player_exiting_tree.connect(player_exiting_tree)
for i in get_children():
if i is CollisionShape3D:
level_collision_shapes.append(i)
@@ -18,8 +20,10 @@ func _on_body_exited(body: Node3D) -> void:
body.global_position = body.last_ground_pos + Vector3(0,10,0)
func toggle_collision(collision_state):
print("COLLISION STATE: ",collision_state)
check_collision = collision_state
if level_collision_shapes != null and level_collision_shapes != []:
for i in level_collision_shapes:
i.disabled = collision_state
func player_exiting_tree():
toggle_collision(false)