26 lines
981 B
GDScript
26 lines
981 B
GDScript
extends AbstractScreen
|
|
|
|
# Initialization
|
|
func init(lvl: Maze, pl: MazePlayer):
|
|
var has_won = lvl.at(pl.position.x, pl.position.y).feature == Cell.Feature.EXIT
|
|
if has_won:
|
|
$EndCondition.text = "Left the labyrinth."
|
|
else:
|
|
$EndCondition.text = "Rescued after using an emergency flare."
|
|
$NbChests.text = "Found " + str(pl.nb_chests_found) + " chests."
|
|
if has_won:
|
|
$NbSteps.text = "Reached the exit in " + str(pl.nb_steps) + " steps."
|
|
else:
|
|
$NbSteps.text = "Gave up after " + str(pl.nb_steps) + " steps."
|
|
$MapViewer.init(lvl, pl)
|
|
|
|
func _process(_delta):
|
|
if Input.is_action_just_pressed("ui_accept"):
|
|
emit_signal("next_screen", "start")
|
|
if Input.is_action_just_pressed("ui_cancel"):
|
|
emit_signal("next_screen", "start")
|
|
if Input.is_action_just_pressed("ui_menu"):
|
|
emit_signal("next_screen", "start")
|
|
if Input.is_action_just_pressed("ui_info"):
|
|
emit_signal("next_screen", "start")
|