did a lot of stuff holy shit
This commit is contained in:
26
scripts/autoloads/level_manager.gd
Normal file
26
scripts/autoloads/level_manager.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node
|
||||
|
||||
@onready var transition: CanvasLayer = $Transition
|
||||
|
||||
@export var levels: Array[PackedScene]
|
||||
var level_pointer: int = 0
|
||||
|
||||
const PROGRESS_SAVE_PATH: String = "user://save.cfg"
|
||||
var progress_save: ConfigFile = ConfigFile.new()
|
||||
|
||||
func _ready() -> void:
|
||||
progress_save.load(PROGRESS_SAVE_PATH)
|
||||
|
||||
func next_level() -> void:
|
||||
level_pointer += 1
|
||||
if level_pointer < levels.size():
|
||||
transition.show()
|
||||
await get_tree().create_timer(1).timeout
|
||||
get_tree().change_scene_to_packed(levels[level_pointer])
|
||||
await get_tree().create_timer(2).timeout
|
||||
transition.hide()
|
||||
else:
|
||||
get_tree().change_scene_to_file("res://scenes/gui/menus/game_finished.tscn")
|
||||
|
||||
func start_last_level() -> void:
|
||||
pass
|
Reference in New Issue
Block a user