more hud work

This commit is contained in:
derek
2024-12-13 15:20:17 -06:00
parent 9bb5332ba6
commit ec75bffb70
29 changed files with 178 additions and 81 deletions

View File

@@ -3,6 +3,8 @@ extends Control
@onready var level_control = get_tree().current_scene
@onready var player: CharacterBody3D = $"../../../.."
var paused
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
visible = false
@@ -26,16 +28,20 @@ func _on_load_pressed() -> void:
func _unhandled_input(event: InputEvent) -> void:
if Input.is_action_just_pressed("escape"):
pause()
if paused:
resume()
else:
pause()
func pause():
paused = true
get_tree().paused = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
player.toggle_hud(false)
player.pause_menu.show()
func resume():
paused = false
hide()
get_tree().paused = false
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)