diff options
author | Logan <logan@cflip.net> | 2023-02-02 02:52:52 -0700 |
---|---|---|
committer | Logan <logan@cflip.net> | 2023-02-02 02:52:52 -0700 |
commit | 818f5ef03baa353b96aadd5b100c1f6ca6b7fedb (patch) | |
tree | 0b48664d94de5a07198ca5c3088adc7a6dfee7e3 | |
parent | f77c7cca424bf28c0c412c9612bc976dfaf612a5 (diff) |
Improve characteristics of pausemenu
-rw-r--r-- | scenes/pausemenu.tscn | 24 | ||||
-rw-r--r-- | scripts/global_variables.gd | 4 | ||||
-rw-r--r-- | scripts/optionsmenu.gd | 4 | ||||
-rw-r--r-- | scripts/pausemenu.gd | 35 |
4 files changed, 54 insertions, 13 deletions
diff --git a/scenes/pausemenu.tscn b/scenes/pausemenu.tscn index 18a9d60..e23e95c 100644 --- a/scenes/pausemenu.tscn +++ b/scenes/pausemenu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://scripts/pausemenu.gd" type="Script" id=1] [ext_resource path="res://textures/options_hover.png" type="Texture" id=2] @@ -9,10 +9,12 @@ [ext_resource path="res://textures/quit.png" type="Texture" id=7] [ext_resource path="res://textures/help.png" type="Texture" id=8] [ext_resource path="res://textures/help_hover.png" type="Texture" id=9] +[ext_resource path="res://theme_data/interface_theme.tres" type="Theme" id=10] [node name="PauseMenu" type="Control"] margin_right = 214.0 margin_bottom = 120.0 +theme = ExtResource( 10 ) script = ExtResource( 1 ) [node name="ColorRect" type="ColorRect" parent="."] @@ -23,14 +25,15 @@ __meta__ = { "_edit_use_anchors_": true } -[node name="PauseLabel" type="Label" parent="."] +[node name="Panel" type="Panel" parent="."] anchor_left = 0.5 +anchor_top = 0.5 anchor_right = 0.5 -margin_left = -24.0 -margin_right = 24.0 -margin_bottom = 16.0 -custom_colors/font_color_shadow = Color( 0.270588, 0.294118, 0.443137, 1 ) -text = "PAUSED" +anchor_bottom = 0.5 +margin_left = -43.0 +margin_top = -26.0 +margin_right = 43.0 +margin_bottom = 13.0 [node name="HoverLabel" type="Label" parent="."] anchor_left = 0.5 @@ -41,6 +44,7 @@ margin_left = -38.0 margin_top = -25.0 margin_right = 38.0 margin_bottom = -9.0 +text = "PAUSED" align = 1 valign = 1 @@ -81,7 +85,13 @@ margin_bottom = 16.0 texture_normal = ExtResource( 7 ) texture_hover = ExtResource( 6 ) +[connection signal="mouse_entered" from="ColorRect" to="." method="_on_ColorRect_mouse_entered"] +[connection signal="mouse_entered" from="Panel" to="." method="_on_Panel_mouse_entered"] +[connection signal="mouse_entered" from="HBoxContainer/RestartButton" to="." method="_on_RestartButton_mouse_entered"] [connection signal="pressed" from="HBoxContainer/RestartButton" to="." method="_on_RestartButton_pressed"] +[connection signal="mouse_entered" from="HBoxContainer/OptionsButton" to="." method="_on_OptionsButton_mouse_entered"] [connection signal="pressed" from="HBoxContainer/OptionsButton" to="." method="_on_OptionsButton_pressed"] +[connection signal="mouse_entered" from="HBoxContainer/HelpButton" to="." method="_on_HelpButton_mouse_entered"] [connection signal="pressed" from="HBoxContainer/HelpButton" to="." method="_on_HelpButton_pressed"] +[connection signal="mouse_entered" from="HBoxContainer/QuitButton" to="." method="_on_QuitButton_mouse_entered"] [connection signal="pressed" from="HBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/scripts/global_variables.gd b/scripts/global_variables.gd index f52c06b..4d01ff5 100644 --- a/scripts/global_variables.gd +++ b/scripts/global_variables.gd @@ -11,3 +11,7 @@ var volume_music = 0 var volume_music_enabled = true var volume_sfx = 0 var volume_sfx_enabled = true + +func reset_variables(): + global_variables.score = 0 + global_variables.timer_zero = false diff --git a/scripts/optionsmenu.gd b/scripts/optionsmenu.gd index 6fb9aa8..67e73c8 100644 --- a/scripts/optionsmenu.gd +++ b/scripts/optionsmenu.gd @@ -10,6 +10,10 @@ func _ready(): $Control/VBoxContainer/GridContainer/VolumeSFXContainer/VolumeSFXSlider.value = global_variables.volume_sfx $Control/VBoxContainer/GridContainer/FullscreenCheckButton.set_pressed_no_signal(OS.window_fullscreen) +func _input(event): + if event.is_action_pressed("escape"): + queue_free() + func _on_ReturnButton_pressed(): queue_free() diff --git a/scripts/pausemenu.gd b/scripts/pausemenu.gd index 3fb525d..d31bee8 100644 --- a/scripts/pausemenu.gd +++ b/scripts/pausemenu.gd @@ -1,18 +1,20 @@ extends Control func _input(event): - if event.is_action_pressed("escape"): + if !is_instance_valid(get_node_or_null("OptionsMenu")) && event.is_action_pressed("escape"): var pause_toggle = !get_tree().paused get_tree().paused = pause_toggle visible = pause_toggle + rename_hover_panel("PAUSED") func _on_RestartButton_pressed(): get_tree().reload_current_scene() get_tree().paused = false - reset_variables() + global_variables.reset_variables() func _on_OptionsButton_pressed(): add_child(preload("res://scenes/optionsmenu.tscn").instance()) + rename_hover_panel("PAUSED") func _on_HelpButton_pressed(): pass @@ -20,8 +22,29 @@ func _on_HelpButton_pressed(): func _on_QuitButton_pressed(): get_tree().change_scene("res://scenes/mainmenu.tscn") get_tree().paused = false - reset_variables() + global_variables.reset_variables() + + +func _on_RestartButton_mouse_entered(): + rename_hover_panel("RESTART") + +func _on_OptionsButton_mouse_entered(): + rename_hover_panel("OPTIONS") + +func _on_HelpButton_mouse_entered(): + rename_hover_panel("HELP") + +func _on_QuitButton_mouse_entered(): + rename_hover_panel("QUIT") + +func _on_Panel_mouse_entered(): + rename_hover_panel("PAUSED") + +func _on_ColorRect_mouse_entered(): + rename_hover_panel("PAUSED") + +func rename_hover_panel(hover_name): + $HoverLabel.text = hover_name + + -func reset_variables(): - global_variables.score = 0 - global_variables.timer_zero = false |