39 lines
1.0 KiB
GDScript
39 lines
1.0 KiB
GDScript
extends Node
|
|
|
|
var levels: Dictionary = {
|
|
"test1": "uid://dtkg88hfvln2d",
|
|
"test2": "uid://b1jbl6gvlvpvy",
|
|
"1": "uid://cnq5ir1kfkqan",
|
|
"2": "uid://dd88vrckuqggu",
|
|
"3": "uid://dk46prqr68bh0",
|
|
"4": "uid://uo8cy276f3cp",
|
|
"5": "uid://b2j2gwes24th2",
|
|
"6": "uid://iw6327x7cecu",
|
|
"END": "uid://dcrnnrnvbqmq0"
|
|
}
|
|
|
|
func reset_level() -> void:
|
|
await get_tree().create_timer(1).timeout
|
|
get_tree().reload_current_scene()
|
|
|
|
func _process(delta: float) -> void:
|
|
if Input.is_action_just_pressed("RESTART"):
|
|
reset_level()
|
|
if OS.has_feature("debug"):
|
|
if Input.is_action_just_pressed("1"):
|
|
change_level("1")
|
|
if Input.is_action_just_pressed("2"):
|
|
change_level("2")
|
|
if Input.is_action_just_pressed("3"):
|
|
change_level("3")
|
|
if Input.is_action_just_pressed("4"):
|
|
change_level("4")
|
|
if Input.is_action_just_pressed("5"):
|
|
change_level("5")
|
|
if Input.is_action_just_pressed("6"):
|
|
change_level("6")
|
|
|
|
func change_level(levelName: String) -> void:
|
|
print(levels[levelName])
|
|
get_tree().change_scene_to_file(levels[levelName])
|