extends Button

export(String, FILE) var next_scene_path: = ""
onready var selected_level_base_path: String = "res://src/Levels/"

func _on_button_up() -> void:
	get_tree().change_scene(next_scene_path)
	get_tree().get_current_scene().queue_free()
	get_tree().paused = false

func _get_configuration_warning() -> String:
	return "next_scene_path must be set for the button to work" if next_scene_path == "" else ""

func _level_selection_changed(button):
	next_scene_path = selected_level_base_path + button.text + ".tscn"
