mirror of
https://github.com/Relintai/the_tower.git
synced 2024-11-14 10:27:21 +01:00
35 lines
647 B
GDScript
35 lines
647 B
GDScript
extends Node
|
|
|
|
export(Array, PackedScene) var levels
|
|
|
|
var current_level_index : int = 0
|
|
|
|
var level : Node = null
|
|
|
|
func _enter_tree():
|
|
level = levels[current_level_index].instance()
|
|
add_child(level)
|
|
|
|
func next_level():
|
|
call_deferred("next")
|
|
|
|
func next():
|
|
level.queue_free()
|
|
remove_child(level)
|
|
current_level_index += 1
|
|
|
|
if current_level_index >= levels.size():
|
|
current_level_index = 0
|
|
|
|
level = levels[current_level_index].instance()
|
|
add_child(level)
|
|
|
|
func reload():
|
|
call_deferred("reload_deferred")
|
|
|
|
func reload_deferred():
|
|
level.queue_free()
|
|
remove_child(level)
|
|
level = levels[current_level_index].instance()
|
|
add_child(level)
|