Added escape button menu navigation

remotes/1705382094874458415/tmp_refs/heads/godot4-port
Jan 2020-06-19 22:49:02 +02:00
parent c4608990a6
commit eebfff2929
1 changed files with 10 additions and 2 deletions

12
Game.gd
View File

@ -16,10 +16,18 @@ func _ready():
func _input(event):
if event.is_action_pressed("ToggleMenu"):
if GAME_MODE == "PLAYING":
if GAME_MODE == "PLAYING" and not $MenuContainer.is_visible():
open_menu()
else:
elif $MenuContainer/MainMenu.is_visible():
close_menu()
else:
# Find the back button
var children = $MenuContainer.get_children()
for child in children:
var buttons = child.get_children()
for button in buttons:
if button.name == "Back":
button.emit_signal("pressed")
func open_menu():
GAME_MODE = "MENU"