Frontier-of-Hell/scripts/ui/victory.gd

26 lines
666 B
GDScript3
Raw Normal View History

2023-10-19 15:20:13 +02:00
extends Control
2023-10-20 19:23:10 +02:00
var game_data = load("res://scripts/data/data.gd").new()
var data = game_data.load_data()
2023-10-19 15:20:13 +02:00
var next_stage: int = 0
func set_next_stage(value: int):
if value != 0:
next_stage = value
else:
$Panel/MarginContainer/VBoxContainer/NextStage.text = "Main Menu"
2023-10-20 19:23:10 +02:00
func unlock_next_stage():
if next_stage != 0:
data['unlocked_stage'] = next_stage
game_data.save_data(data)
2023-10-19 15:20:13 +02:00
func _on_next_stage_pressed():
get_tree().paused = false
if next_stage != 0:
get_tree().change_scene_to_file("res://scenes/stages/stage_{stage_id}.tscn".format({"stage_id": str(next_stage)}))
else:
get_tree().change_scene_to_file("res://scenes/ui/main_menu.tscn")