Added escape button menu navigation
parent
c4608990a6
commit
eebfff2929
12
Game.gd
12
Game.gd
|
@ -16,10 +16,18 @@ func _ready():
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event.is_action_pressed("ToggleMenu"):
|
if event.is_action_pressed("ToggleMenu"):
|
||||||
if GAME_MODE == "PLAYING":
|
if GAME_MODE == "PLAYING" and not $MenuContainer.is_visible():
|
||||||
open_menu()
|
open_menu()
|
||||||
else:
|
elif $MenuContainer/MainMenu.is_visible():
|
||||||
close_menu()
|
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():
|
func open_menu():
|
||||||
GAME_MODE = "MENU"
|
GAME_MODE = "MENU"
|
||||||
|
|
Reference in New Issue