extends Node2D

# List of all levels in its order.
var level_list = {
	#0: {
	#	"scene"			: "Opening",
	#	"description"	: "Opening",
	#	"next" 			: 1
	#},
	0: {
		"scene"			: "TitleScreen",
		"description"	: "Title Screen!",
		"next" 			: 1
	},
	1: {
		"scene"			: "Level",
		"description"	: "Gameplay Level",
		"next" 			: 2
	},
	2: {
		"scene"			: "Gameover",
		"description"	: "Game Over",
		"next" 			: 0,
		"secret"		: 1
	},
}



# ----- level code -------

var actual_level_id = 0

func get_actual_scene():
	return get_scene(actual_level_id)


func get_next_scene():
	if not level_list.has(actual_level_id): return 0
	if not level_list[actual_level_id].has('next'): return 0
	var next_number = int(level_list[actual_level_id]['next'])
	return get_scene(next_number)

func get_next_secret_scene():
	if not level_list.has(actual_level_id): return 0
	if not level_list[actual_level_id].has('secret'): return 0
	var next_number = int(level_list[actual_level_id]['secret'])
	return get_scene(next_number)


func get_scene(level_id):
	if not level_list.has(level_id): return ""
	if not level_list[level_id].has("scene"): return ""
	actual_level_id = level_id
	return level_list[level_id]["scene"]

func get_description(level_id):
	if not level_list.has(level_id): return ""
	if not level_list[level_id].has("description"): return ""
	return level_list[level_id]["description"]
