Feat/9 adding main menu fundamentals #13

Merged
Dotts merged 4 commits from feat/9-adding-main-menu-fundamentals into main 2026-06-06 10:09:50 -07:00
Showing only changes of commit 45353dc982 - Show all commits
+14 -1
View File
@@ -18,6 +18,12 @@ func _ready() -> void:
func _process(delta: float) -> void: func _process(delta: float) -> void:
if _player_out_of_bounds: if _player_out_of_bounds:
# If the player dies while out of bounds, stop the timer and remove the UI
if "is_dead" in _player_out_of_bounds and _player_out_of_bounds.is_dead:
_player_out_of_bounds = null
_remove_ui()
return
# Player is outside the combat area! # Player is outside the combat area!
time_left -= delta time_left -= delta
if time_left <= 0.0: if time_left <= 0.0:
@@ -39,6 +45,12 @@ func _process(delta: float) -> void:
func _on_body_exited(body: Node3D) -> void: func _on_body_exited(body: Node3D) -> void:
if body.name == "Player": if body.name == "Player":
# Don't trigger if the player is already dead or the scene is tearing down
if "is_dead" in body and body.is_dead:
return
if body.is_queued_for_deletion() or not is_inside_tree():
return
_player_out_of_bounds = body _player_out_of_bounds = body
time_safe = 0.0 # Reset recovery timer time_safe = 0.0 # Reset recovery timer
_create_ui() _create_ui()
@@ -74,7 +86,8 @@ func _create_ui() -> void:
_ui_layer.add_child(_ui_label) _ui_layer.add_child(_ui_label)
get_tree().current_scene.add_child(_ui_layer) if get_tree().current_scene:
get_tree().current_scene.call_deferred("add_child", _ui_layer)
func _remove_ui() -> void: func _remove_ui() -> void:
if _ui_layer: if _ui_layer: