mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-09 19:04:36 +01:00
30 lines
488 B
GDScript
30 lines
488 B
GDScript
extends Node
|
|
|
|
var chapters
|
|
|
|
func _ready():
|
|
reload()
|
|
|
|
func reload():
|
|
chapters = []
|
|
|
|
var dir = Directory.new()
|
|
dir.open("res://levels")
|
|
dir.list_dir_begin()
|
|
|
|
var chapter_names = []
|
|
|
|
while true:
|
|
var file = dir.get_next()
|
|
if file == "":
|
|
break
|
|
elif not file.begins_with("."):
|
|
chapter_names.append(file)
|
|
|
|
dir.list_dir_end()
|
|
chapter_names.sort()
|
|
|
|
for c in chapter_names:
|
|
var chapter = Chapter.new()
|
|
chapter.load("res://levels/%s" % c)
|
|
chapters.push_back(chapter)
|