Files
fps_project_1/scripts/level_bounds.gd
2025-03-30 18:44:54 -05:00

26 lines
776 B
GDScript

extends Area3D
class_name LevelBounds
var level_collision_shapes : Array[CollisionShape3D]
var check_collision = true
func _ready() -> void:
for i in get_children():
if i is CollisionShape3D:
level_collision_shapes.append(i)
func _on_body_exited(body: Node3D) -> void:
if check_collision == true:
var level_control = get_tree().current_scene
if level_control.gamemode.die_on_leaving_bounds == true:
get_tree().current_scene.die()
else:
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