SlimePlatformer/Levels/Maze/maze_win_menu.gd
tachyonwolf e7ae22b8cd Add Maze mode with one-way tubes and a soft-lock check
- Main menu "Maze" button opens a setup panel (width, height in screens;
  complexity 1-5) and generates a maze of rock chambers joined by tubes,
  with Start and End pads and a win panel.
- New one-way tube kind: orange tiles that only let the slime in at their
  entrance, with motes drifting into it (OneWayTube, TubeVacuum). The
  auto-tube trace moved to PixelStream.trace_tube so the player and the
  maze validator share it.
- Generation: chamber graph (spanning tree rooted at End, one-way tubes
  only towards End on the route, extra tubes), carved with AStarGrid2D.
  MazeValidator re-derives the chamber graph from the tiles and checks
  that End is reachable from every chamber reachable from Start.
- tests/maze_check.gd: headless batch check (360 mazes) plus a known
  soft-lock the validator must reject. See docs/MAZE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:45:46 -06:00

31 lines
835 B
GDScript

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)