aboutsummaryrefslogblamecommitdiffstats
path: root/godot/scripts/LevelLoader.gd
blob: 538d4ef7b31e37411c27cdae105dcc8ac1fd83bc (plain) (tree)





























                                                                           
extends Node

const NUM_LEVELS = 9

var current_level_id = 0
var levels = []

# Called when the node enters the scene tree for the first time.
func _ready():
	for i in range(NUM_LEVELS):
		levels.append(get_node("/root/Game/Level%d" % (i+1)))
		
	levels[0].show()


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#	pass

func load_next_level():
	levels[current_level_id].hide()
	current_level_id = current_level_id + 1
	
	if current_level_id >= NUM_LEVELS:
		# TODO load main menu
		return 
	
	# TODO teleport the die to the start point
	levels[current_level_id].show()