extends Control # The Maze button's panel: pick the maze's size (in screens) and complexity, # then Generate. Laid out like the options screen. What each setting does is # in MazeSettings and docs/MAZE.md. signal closed const MAZE_SCENE = "res://Levels/Maze/maze_level.tscn" @onready var widthBox: SpinBox = $CenterContainer/PanelContainer/VBoxContainer/SettingList/WidthBox @onready var heightBox: SpinBox = $CenterContainer/PanelContainer/VBoxContainer/SettingList/HeightBox @onready var complexityBox: SpinBox = $CenterContainer/PanelContainer/VBoxContainer/SettingList/ComplexityBox @onready var generateButton: Button = $CenterContainer/PanelContainer/VBoxContainer/Buttons/GenerateButton func _ready() -> void: hide() _set_range(widthBox, MazeSettings.MIN_WIDTH, MazeSettings.MAX_WIDTH) _set_range(heightBox, MazeSettings.MIN_HEIGHT, MazeSettings.MAX_HEIGHT) _set_range(complexityBox, MazeSettings.MIN_COMPLEXITY, MazeSettings.MAX_COMPLEXITY) func open() -> void: widthBox.value = MazeSettings.width heightBox.value = MazeSettings.height complexityBox.value = MazeSettings.complexity show() generateButton.grab_focus() func close() -> void: hide() closed.emit() static func _set_range(box: SpinBox, lowest: int, highest: int) -> void: box.min_value = lowest box.max_value = highest box.step = 1 box.rounded = true func _on_generate_button_pressed() -> void: MazeSettings.width = int(widthBox.value) MazeSettings.height = int(heightBox.value) MazeSettings.complexity = int(complexityBox.value) MazeSettings.mazeSeed = 0 Transition.change_scene(MAZE_SCENE) func _on_back_button_pressed() -> void: close()