From 82b8e8f458fd4407e2c7fb475853970c3754c152 Mon Sep 17 00:00:00 2001 From: blinry Date: Tue, 5 Jan 2021 13:27:52 +0100 Subject: [PATCH] Reload button for level sequence. Order tag levels. --- levels/tags/sequence | 4 ++++ scenes/level_select.gd | 23 +++++++++++++++-------- scenes/level_select.tscn | 11 +++++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 levels/tags/sequence diff --git a/levels/tags/sequence b/levels/tags/sequence new file mode 100644 index 0000000..fd63d9c --- /dev/null +++ b/levels/tags/sequence @@ -0,0 +1,4 @@ +add-tag +remove-tag +add-tag-later +remote-tag diff --git a/scenes/level_select.gd b/scenes/level_select.gd index 0dbb66d..18def77 100644 --- a/scenes/level_select.gd +++ b/scenes/level_select.gd @@ -3,6 +3,21 @@ extends Control onready var level_list = $ScrollContainer/MarginContainer/Levels func _ready(): + reload() + +func load(chapter_id, level_id): + game.current_chapter = chapter_id + game.current_level = level_id + get_tree().change_scene("res://scenes/main.tscn") + +func back(): + get_tree().change_scene("res://scenes/title.tscn") + + +func reload(): + for child in level_list.get_children(): + child.queue_free() + var chapter_id = 0 levels.reload() @@ -25,11 +40,3 @@ func _ready(): level_id += 1 chapter_id += 1 - -func load(chapter_id, level_id): - game.current_chapter = chapter_id - game.current_level = level_id - get_tree().change_scene("res://scenes/main.tscn") - -func back(): - get_tree().change_scene("res://scenes/title.tscn") diff --git a/scenes/level_select.tscn b/scenes/level_select.tscn index c50d57b..84f0834 100644 --- a/scenes/level_select.tscn +++ b/scenes/level_select.tscn @@ -42,4 +42,15 @@ text = "Back" __meta__ = { "_edit_use_anchors_": false } + +[node name="Button2" type="Button" parent="."] +margin_left = 138.588 +margin_top = 59.3009 +margin_right = 226.588 +margin_bottom = 98.3009 +text = "Reload" +__meta__ = { +"_edit_use_anchors_": false +} [connection signal="pressed" from="Button" to="." method="back"] +[connection signal="pressed" from="Button2" to="." method="reload"]