From 4396504480262be0b02fa8326a0b77a430bbd629 Mon Sep 17 00:00:00 2001 From: KingGurke Date: Tue, 3 Oct 2023 00:02:35 +0200 Subject: [PATCH] added next level button, adjusted lv 1 background, fixed menu background when calling options menu from main menu --- src/gui/menu/main.gd | 4 ++-- src/gui/menu/score_submit.gd | 10 ++++++++++ src/gui/menu/score_submit.tscn | 24 ++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/gui/menu/main.gd b/src/gui/menu/main.gd index 8baa201..3e45f08 100644 --- a/src/gui/menu/main.gd +++ b/src/gui/menu/main.gd @@ -31,8 +31,8 @@ func _on_start_button_pressed(): func _on_options_button_pressed(): var options = load("res://src/gui/menu/options.tscn").instantiate() get_parent().add_child((options)) - options.last_menu = self - hide() + options.last_menu = main_menu + main_menu.hide() func _on_quit_button_pressed(): get_tree().quit() diff --git a/src/gui/menu/score_submit.gd b/src/gui/menu/score_submit.gd index a66d466..de55f9b 100644 --- a/src/gui/menu/score_submit.gd +++ b/src/gui/menu/score_submit.gd @@ -19,3 +19,13 @@ func _on_retry_button_pressed(): func _on_submit_button_pressed(): pass # Replace with function body. + + +func _on_next_button_pressed(): + var next_level = level_nr + 1 + if next_level > 12: + next_level = 1 + load_level("res://src/game/levels/level_%s.tscn" % next_level) + +func load_level(path: String): + get_tree().change_scene_to_file(path) diff --git a/src/gui/menu/score_submit.tscn b/src/gui/menu/score_submit.tscn index 5bb8316..7ecce8d 100644 --- a/src/gui/menu/score_submit.tscn +++ b/src/gui/menu/score_submit.tscn @@ -79,9 +79,9 @@ anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 offset_left = -60.0 -offset_top = -109.0 +offset_top = -157.0 offset_right = 60.0 -offset_bottom = -69.0 +offset_bottom = -117.0 grow_horizontal = 2 grow_vertical = 0 size_flags_horizontal = 4 @@ -108,5 +108,25 @@ size_flags_vertical = 8 focus_neighbor_bottom = NodePath("../StartButton") text = "SUBMIT" +[node name="NextButton" type="Button" parent="Panel"] +custom_minimum_size = Vector2(120, 40) +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -60.0 +offset_top = -109.0 +offset_right = 60.0 +offset_bottom = -69.0 +grow_horizontal = 2 +grow_vertical = 0 +size_flags_horizontal = 4 +size_flags_vertical = 8 +focus_neighbor_bottom = NodePath("../StartButton") +text = "NEXT LEVEL" + [connection signal="pressed" from="Panel/RetryButton" to="." method="_on_retry_button_pressed"] [connection signal="pressed" from="Panel/SubmitButton" to="." method="_on_submit_button_pressed"] +[connection signal="pressed" from="Panel/NextButton" to="." method="_on_next_button_pressed"]