fix: Pause Menu now halts the app state and restores it, and ensures savegame
This commit is contained in:
parent
d58225f21b
commit
b57aa76e23
|
|
@ -111,7 +111,7 @@ var last_mode := DisplayServer.WINDOW_MODE_WINDOWED
|
|||
func _unhandled_input(event: InputEvent) -> void:
|
||||
#if event.is_action_type(): print_debug("Unhandled Input", event)
|
||||
|
||||
if event.is_action_pressed("ui_pause"):
|
||||
if event.is_action_pressed("ui_pause") and state == AppState.PLAY:
|
||||
state = AppState.PAUSE
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ func _on_help_pressed():
|
|||
|
||||
var last_mouse_mode: Input.MouseMode
|
||||
func appear():
|
||||
State.save_game.save_to_file(get_tree().root.get_texture())
|
||||
|
||||
get_tree().paused = true
|
||||
show()
|
||||
last_mouse_mode = Input.mouse_mode
|
||||
|
|
@ -29,6 +31,7 @@ func appear():
|
|||
|
||||
|
||||
func disappear():
|
||||
Main.state = Main.AppState.PLAY
|
||||
hide()
|
||||
Input.mouse_mode = last_mouse_mode
|
||||
get_tree().paused = false
|
||||
|
|
|
|||
Loading…
Reference in New Issue