SlimePlatformer/Levels/Maze/maze_win_menu.gd

32 lines
835 B
GDScript3
Raw Permalink Normal View History

class_name MazeWinMenu
extends CanvasLayer
# Shown when the player reaches a maze's End: a new maze with the same size and
# complexity, or back to the main menu. Pauses the game while it's up (its
# process_mode is Always, like the pause menu).
const MAZE_SCENE = "res://Levels/Maze/maze_level.tscn"
const MENU_SCENE = "res://UI/main_menu.tscn"
@onready var newMazeButton: Button = $CenterContainer/PanelContainer/VBoxContainer/NewMazeButton
func _ready() -> void:
hide()
func open() -> void:
show()
get_tree().paused = true
newMazeButton.grab_focus()
func _on_new_maze_button_pressed() -> void:
get_tree().paused = false # The paused state carries over to the new scene.
Transition.change_scene(MAZE_SCENE)
func _on_main_menu_button_pressed() -> void:
get_tree().paused = false
Transition.change_scene(MENU_SCENE)