Skip to content

Commit

Permalink
Add main menu button
Browse files Browse the repository at this point in the history
  • Loading branch information
Janorico committed May 31, 2023
1 parent a7e9c9f commit e40ff83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scenes/game/pause_menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ anchor_bottom = 1.0

[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
margin_left = 452.0
margin_top = 226.0
margin_top = 210.0
margin_right = 572.0
margin_bottom = 350.0
margin_bottom = 366.0
rect_min_size = Vector2( 120, 0 )

[node name="ResumeButton" type="Button" parent="CenterContainer/VBoxContainer"]
Expand All @@ -141,10 +141,16 @@ margin_right = 120.0
margin_bottom = 92.0
text = "About"

[node name="QuitButton" type="Button" parent="CenterContainer/VBoxContainer"]
[node name="MainMenuButton" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 96.0
margin_right = 120.0
margin_bottom = 124.0
text = "Main Menu"

[node name="QuitButton" type="Button" parent="CenterContainer/VBoxContainer"]
margin_top = 128.0
margin_right = 120.0
margin_bottom = 156.0
text = "Quit"

[node name="SettingsDialog" type="ConfirmationDialog" parent="."]
Expand Down Expand Up @@ -274,6 +280,7 @@ anims/show = SubResource( 2 )
[connection signal="pressed" from="CenterContainer/VBoxContainer/ResumeButton" to="." method="resume"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/SettingsButton" to="SettingsDialog" method="popup_centered"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/AboutButton" to="AboutDialog" method="popup_centered"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/MainMenuButton" to="." method="_main_menu"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/QuitButton" to="." method="_quit"]
[connection signal="about_to_show" from="SettingsDialog" to="SettingsDialog" method="_on_about_to_show"]
[connection signal="confirmed" from="SettingsDialog" to="SettingsDialog" method="_on_confirmed"]
Expand Down
5 changes: 5 additions & 0 deletions scripts/game/PauseMenu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func resume():
player.paused = false


func _main_menu():
# warning-ignore:return_value_discarded
get_tree().change_scene("res://scenes/startup.tscn")


func _quit():
get_tree().quit(0)

Expand Down

0 comments on commit e40ff83

Please sign in to comment.