1
Fork 0
mirror of https://github.com/Cookie-CHR/LD54-SPAce-ltd.git synced 2024-11-21 23:14:18 +00:00
space-ltd/Components/level_manager.gd
2023-10-15 18:46:50 +02:00

27 lines
686 B
GDScript

extends Control
var level_scn = preload("res://scenes/level.tscn")
func _go_to_level(num):
get_tree().get_current_scene().queue_free()
var root = get_tree().get_root()
if(!Diction.planets_lvl.has(str(num))):
get_tree().change_scene_to_file("res://scenes/victory.tscn")
else:
var level = level_scn.instantiate()
level.name = "Level"
level.curr_level = num
root.add_child(level)
get_tree().set_current_scene(level)
func _go_to_credits():
get_tree().change_scene_to_file("res://scenes/credits.tscn")
func _go_to_menu():
get_tree().change_scene_to_file("res://scenes/menu.tscn")
func _go_to_map():
get_tree().change_scene_to_file("res://scenes/map.tscn")