more hud work
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user