From 41e14be5dd3a63566bd8939f79aea35b77b3f00b Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Mon, 12 Oct 2020 20:09:51 +0200 Subject: [PATCH] Add "title" section to the level format --- README.md | 2 ++ level.gd | 2 ++ levels/contrib/template | 2 ++ levels/high-level/first-remote | 2 ++ levels/high-level/motivation | 2 ++ levels/high-level/restore | 2 ++ levels/high-level/setup | 2 ++ main.gd | 2 +- 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb64c2b..81091c7 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Wanna build your own level? Great! Here's how to do it: ### Level format ``` +title = This is the level's title + [description] This text will be shown when the level starts. diff --git a/level.gd b/level.gd index 6337617..601557a 100644 --- a/level.gd +++ b/level.gd @@ -2,6 +2,7 @@ extends Node class_name Level var slug +var title var description var congrats var repos = {} @@ -16,6 +17,7 @@ func load(path): # This is a new-style level. var config = helpers.parse(path) + title = config.get("title", slug) description = config.get("description", "(no description)") congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next Level'.") diff --git a/levels/contrib/template b/levels/contrib/template index 40a8329..90d5e4f 100644 --- a/levels/contrib/template +++ b/levels/contrib/template @@ -1,3 +1,5 @@ +title = This is the level's title + [description] This text will be shown when the level starts. diff --git a/levels/high-level/first-remote b/levels/high-level/first-remote index 40c0825..7ebb065 100644 --- a/levels/high-level/first-remote +++ b/levels/high-level/first-remote @@ -1,3 +1,5 @@ +title = Your first remote + [description] A friend has asked you to help with an essay about hobbies! She has already started to write a list, started tracking it in a Git repository. You can get a copy by typing diff --git a/levels/high-level/motivation b/levels/high-level/motivation index 5fa3049..690fcfe 100644 --- a/levels/high-level/motivation +++ b/levels/high-level/motivation @@ -1,3 +1,5 @@ +title = Why Git? + [description] (This chapter is not a complete introduction to Git yet, but it will explain some of the basic concepts to you.) diff --git a/levels/high-level/restore b/levels/high-level/restore index bde0d89..6bb93f7 100644 --- a/levels/high-level/restore +++ b/levels/high-level/restore @@ -1,3 +1,5 @@ +title = Looking into the past + [description] You've been working on your essay for a while. But - ughh! Now your cat walks over your keyboard and "helps you", so now it's all messed up again! :/ diff --git a/levels/high-level/setup b/levels/high-level/setup index b4fa02d..e6678bc 100644 --- a/levels/high-level/setup +++ b/levels/high-level/setup @@ -1,3 +1,5 @@ +title = A better way + [description] One month later, you're woking on an essay about tardigrades! diff --git a/main.gd b/main.gd index 37c70fa..43c9056 100644 --- a/main.gd +++ b/main.gd @@ -61,7 +61,7 @@ func load_level(level_id): var level = levels.chapters[current_chapter].levels[current_level] level_description.bbcode_text = level.description level_congrats.bbcode_text = level.congrats - level_name.text = level.slug + level_name.text = level.title for r in repositories_node.get_children(): r.queue_free()