Add "title" section to the level format

This commit is contained in:
Sebastian Morr 2020-10-12 20:09:51 +02:00
parent a457afdadb
commit 41e14be5dd
8 changed files with 15 additions and 1 deletions

View file

@ -35,6 +35,8 @@ Wanna build your own level? Great! Here's how to do it:
### Level format ### Level format
``` ```
title = This is the level's title
[description] [description]
This text will be shown when the level starts. This text will be shown when the level starts.

View file

@ -2,6 +2,7 @@ extends Node
class_name Level class_name Level
var slug var slug
var title
var description var description
var congrats var congrats
var repos = {} var repos = {}
@ -16,6 +17,7 @@ func load(path):
# This is a new-style level. # This is a new-style level.
var config = helpers.parse(path) var config = helpers.parse(path)
title = config.get("title", slug)
description = config.get("description", "(no description)") 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'.") congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next Level'.")

View file

@ -1,3 +1,5 @@
title = This is the level's title
[description] [description]
This text will be shown when the level starts. This text will be shown when the level starts.

View file

@ -1,3 +1,5 @@
title = Your first remote
[description] [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 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

View file

@ -1,3 +1,5 @@
title = Why Git?
[description] [description]
(This chapter is not a complete introduction to Git yet, but it will explain some of the basic concepts to you.) (This chapter is not a complete introduction to Git yet, but it will explain some of the basic concepts to you.)

View file

@ -1,3 +1,5 @@
title = Looking into the past
[description] [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! :/ 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! :/

View file

@ -1,3 +1,5 @@
title = A better way
[description] [description]
One month later, you're woking on an essay about tardigrades! One month later, you're woking on an essay about tardigrades!

View file

@ -61,7 +61,7 @@ func load_level(level_id):
var level = levels.chapters[current_chapter].levels[current_level] var level = levels.chapters[current_chapter].levels[current_level]
level_description.bbcode_text = level.description level_description.bbcode_text = level.description
level_congrats.bbcode_text = level.congrats level_congrats.bbcode_text = level.congrats
level_name.text = level.slug level_name.text = level.title
for r in repositories_node.get_children(): for r in repositories_node.get_children():
r.queue_free() r.queue_free()