extends AudibleButton

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

func _on_button_up() -> void:
	GlobalAudio.stop_scene_independent("res://assets/music/Shopping For The Future (LOOP).wav")
	GlobalAudio.play_scene_independent("res://assets/sounds/MAGIC_SPELL_Morphing_Synth_Harp_Scales_Deep_stereo.wav", "Effects", -8)
	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"
