Badges when you don't use cards

This commit is contained in:
blinry 2021-01-21 15:08:59 +01:00
parent e87e29a3ed
commit aed852122b
10 changed files with 278 additions and 12 deletions

View file

@ -32,16 +32,28 @@ func reload():
level_list.add_child(l)
for level in chapter.levels:
var hb = HBoxContainer.new()
var b = Button.new()
b.text = level.title
b.align = HALIGN_LEFT
b.size_flags_horizontal = SIZE_EXPAND_FILL
b.connect("pressed", self, "load", [chapter_id, level_id])
var slug = chapter.slug + "/" + level.slug
if slug in game.state["solved_levels"]:
b.set("custom_colors/font_color", Color(0.1, 0.8, 0.1, 1))
b.set("custom_colors/font_color_hover", Color(0.1, 0.8, 0.1, 1))
b.set("custom_colors/font_color_pressed", Color(0.1, 0.8, 0.1, 1))
level_list.add_child(b)
hb.add_child(b)
#
var badge = preload("res://scenes/cli_badge.tscn").instance()
hb.add_child(badge)
badge.active = slug in game.state["cli_badge"]
badge.sparkling = false
level_list.add_child(hb)
level_id += 1
chapter_id += 1