v0.1.0-alpha: first playable
20 rooms, Crumb board token, Home and Game screens only.
This commit is contained in:
commit
f4b4a773f3
113 files changed
+4167
No files matched your search
@@ -0,0 +1,24 @@
|
||||
class_name Levels
|
||||
extends RefCounted
|
||||
|
||||
const PATH := "res://data/levels.json"
|
||||
|
||||
|
||||
static func load_all() -> Array:
|
||||
if not FileAccess.file_exists(PATH):
|
||||
push_warning("No level file at %s. Run tools/generate_levels.gd." % PATH)
|
||||
return []
|
||||
|
||||
var file := FileAccess.open(PATH, FileAccess.READ)
|
||||
if file == null:
|
||||
push_warning("Could not open %s." % PATH)
|
||||
return []
|
||||
|
||||
var parsed = JSON.parse_string(file.get_as_text())
|
||||
file.close()
|
||||
|
||||
if typeof(parsed) != TYPE_ARRAY:
|
||||
push_warning("%s did not contain a JSON array." % PATH)
|
||||
return []
|
||||
|
||||
return parsed
|
||||
Reference in new issue
Block a user