Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu sounds #140

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added addons/top_down/assets/sounds/button_pressed.wav
Binary file not shown.
Binary file added addons/top_down/assets/sounds/menu_back.wav
Binary file not shown.
15 changes: 15 additions & 0 deletions addons/top_down/resources/sounds/button_press.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="SoundResource" load_steps=3 format=3 uid="uid://dtclpjqgsu53p"]

[ext_resource type="Script" path="res://addons/great_games_library/resources/SoundResource/SoundResource.gd" id="1_3muck"]
[ext_resource type="AudioStream" uid="uid://ce2mitcjy8den" path="res://addons/top_down/assets/sounds/button_pressed.wav" id="2_h1u8c"]

[resource]
script = ExtResource("1_3muck")
pitch_min = 0.98
pitch_max = 1.2
volume = -5.0
retrigger_time = 0.032
pitch_add = 0.0
pitch_cooldown = 0.0
pitch_return = 0.0
sound = ExtResource("2_h1u8c")
15 changes: 15 additions & 0 deletions addons/top_down/resources/sounds/menu_back.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="SoundResource" load_steps=3 format=3 uid="uid://b1hy8aowwa5hq"]

[ext_resource type="Script" path="res://addons/great_games_library/resources/SoundResource/SoundResource.gd" id="1_bnses"]
[ext_resource type="AudioStream" uid="uid://cp8s8818liffs" path="res://addons/top_down/assets/sounds/menu_back.wav" id="2_271ce"]

[resource]
script = ExtResource("1_bnses")
pitch_min = 0.98
pitch_max = 1.2
volume = -5.0
retrigger_time = 0.032
pitch_add = 0.0
pitch_cooldown = 0.0
pitch_return = 0.0
sound = ExtResource("2_271ce")
4 changes: 3 additions & 1 deletion addons/top_down/scenes/ui/menu_button.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=5 format=3 uid="uid://b3ww0jqqy1eq7"]
[gd_scene load_steps=6 format=3 uid="uid://b3ww0jqqy1eq7"]

[ext_resource type="Theme" uid="uid://yctjuhnen1br" path="res://addons/top_down/resources/theme/game_gui_theme.theme" id="1_xmmy2"]
[ext_resource type="Material" uid="uid://bgfpnyrqhhy42" path="res://addons/top_down/resources/materials/menu_button.material" id="2_fyqp8"]
[ext_resource type="Script" path="res://addons/top_down/scripts/ui/ButtonAnimation.gd" id="2_v6vgl"]
[ext_resource type="Resource" uid="uid://dtclpjqgsu53p" path="res://addons/top_down/resources/sounds/button_press.tres" id="4_unt5r"]

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_rrpg3"]

Expand All @@ -24,3 +25,4 @@ text = "Name"
script = ExtResource("2_v6vgl")
button = NodePath("../Button")
label = NodePath("../Label")
pressed_sound = ExtResource("4_unt5r")
34 changes: 10 additions & 24 deletions addons/top_down/scenes/ui/screens/game_over.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,21 @@ size_flags_vertical = 3
size_flags_stretch_ratio = 2.0

[node name="TitleLabel" type="Label" parent="MarginContainer/Control/Header"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -47.5
offset_top = -11.5
offset_right = 47.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
layout_mode = 0
offset_left = 104.5
offset_top = 51.5
offset_right = 365.5
offset_bottom = 118.5
theme_override_font_sizes/font_size = 48
text = "Game Over"
horizontal_alignment = 1

[node name="ScoreLabel" type="Label" parent="MarginContainer/Control/Header"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -47.0
offset_top = 44.0
offset_right = 48.0
offset_bottom = 67.0
grow_horizontal = 2
grow_vertical = 2
layout_mode = 0
offset_left = 188.0
offset_top = 129.0
offset_right = 283.0
offset_bottom = 152.0
theme_override_font_sizes/font_size = 16
text = "Score: 69"
horizontal_alignment = 1
Expand Down
35 changes: 22 additions & 13 deletions addons/top_down/scenes/ui/screens/pause.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://cdfnlxijhmk2f"]
[gd_scene load_steps=16 format=3 uid="uid://cdfnlxijhmk2f"]

[ext_resource type="Theme" uid="uid://yctjuhnen1br" path="res://addons/top_down/resources/theme/game_gui_theme.theme" id="1_x1p1w"]
[ext_resource type="Script" path="res://addons/top_down/scripts/ui/title_screen/MenuManager.gd" id="2_0jy2c"]
Expand All @@ -8,6 +8,7 @@
[ext_resource type="Resource" uid="uid://0ghwdk05y7am" path="res://addons/top_down/resources/global_resources/audio_settings_resource.tres" id="4_jh7so"]
[ext_resource type="Resource" uid="uid://dsk5usbvnbqi3" path="res://addons/top_down/resources/global_resources/action_resource.tres" id="4_w4vjo"]
[ext_resource type="Script" path="res://addons/top_down/scripts/ui/title_screen/GraphicsManager.gd" id="5_43th3"]
[ext_resource type="Resource" uid="uid://b1hy8aowwa5hq" path="res://addons/top_down/resources/sounds/menu_back.tres" id="6_di30k"]
[ext_resource type="Resource" uid="uid://bx61rbuwillgh" path="res://addons/top_down/resources/global_resources/graphics_resource.tres" id="6_q7e6m"]
[ext_resource type="Script" path="res://addons/top_down/scripts/ui/title_screen/ChangeSceneButton.gd" id="7_mbpg2"]
[ext_resource type="PackedScene" uid="uid://b3ww0jqqy1eq7" path="res://addons/top_down/scenes/ui/menu_button.tscn" id="8_j4n7a"]
Expand Down Expand Up @@ -50,6 +51,7 @@ focused_node = {
"graphics": NodePath("../MarginContainer/Control/Body/GraphicsMenu/Fullscreen/Button"),
"options": NodePath("../MarginContainer/Control/Body/OptionMenu/Graphics/Button")
}
back_sound = ExtResource("6_di30k")

[node name="AudioManager" type="Node" parent="." node_paths=PackedStringArray("slider_container", "save_button")]
script = ExtResource("3_udjr5")
Expand Down Expand Up @@ -90,21 +92,15 @@ size_flags_vertical = 3
size_flags_stretch_ratio = 2.0

[node name="Label" type="Label" parent="MarginContainer/Control/Header"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -47.5
offset_top = -11.5
offset_right = 47.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
layout_mode = 0
offset_left = 150.5
offset_top = 51.5
offset_right = 319.5
offset_bottom = 118.5
theme_override_font_sizes/font_size = 48
text = "Paused"
horizontal_alignment = 1
vertical_alignment = 1

[node name="Body" type="MarginContainer" parent="MarginContainer/Control"]
layout_mode = 2
Expand All @@ -114,6 +110,7 @@ theme_override_constants/margin_right = 150
theme_override_constants/margin_bottom = 20

[node name="PauseMenu" type="VBoxContainer" parent="MarginContainer/Control/Body"]
visible = false
layout_mode = 2
size_flags_vertical = 10
theme_override_constants/separation = 0
Expand Down Expand Up @@ -166,6 +163,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/OptionMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/OptionMenu/Back" index="2"]
pressed_sound = null

[node name="GraphicsMenu" type="VBoxContainer" parent="MarginContainer/Control/Body"]
visible = false
layout_mode = 2
Expand All @@ -184,6 +184,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/GraphicsMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/GraphicsMenu/Back" index="2"]
pressed_sound = null

[node name="ControlsMenu" type="VBoxContainer" parent="MarginContainer/Control/Body"]
visible = false
layout_mode = 2
Expand All @@ -196,6 +199,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/ControlsMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/ControlsMenu/Back" index="2"]
pressed_sound = null

[node name="AudioMenu" type="VBoxContainer" parent="MarginContainer/Control/Body"]
visible = false
layout_mode = 2
Expand Down Expand Up @@ -238,6 +244,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/AudioMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/AudioMenu/Back" index="2"]
pressed_sound = null

[connection signal="pressed" from="MarginContainer/Control/Body/PauseMenu/Options/Button" to="MenuTraverseManager" method="open" binds= ["options"]]
[connection signal="pressed" from="MarginContainer/Control/Body/OptionMenu/Graphics/Button" to="MenuTraverseManager" method="open" binds= ["graphics"]]
[connection signal="pressed" from="MarginContainer/Control/Body/OptionMenu/Audio/Button" to="MenuTraverseManager" method="open" binds= ["audio"]]
Expand Down
30 changes: 17 additions & 13 deletions addons/top_down/scenes/ui/screens/title.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://dpv4epw1i5b4g"]
[gd_scene load_steps=16 format=3 uid="uid://dpv4epw1i5b4g"]

[ext_resource type="Theme" uid="uid://yctjuhnen1br" path="res://addons/top_down/resources/theme/game_gui_theme.theme" id="1_2uqb8"]
[ext_resource type="Script" path="res://addons/top_down/scripts/ui/title_screen/MenuManager.gd" id="1_q1kds"]
Expand All @@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://c4jwvw17x6fwl" path="res://addons/top_down/scenes/ui/audio_slider.tscn" id="4_ruqo4"]
[ext_resource type="Script" path="res://addons/top_down/scripts/ui/title_screen/GraphicsManager.gd" id="5_kg0vv"]
[ext_resource type="PackedScene" uid="uid://b3ww0jqqy1eq7" path="res://addons/top_down/scenes/ui/menu_button.tscn" id="5_kq1p3"]
[ext_resource type="Resource" uid="uid://b1hy8aowwa5hq" path="res://addons/top_down/resources/sounds/menu_back.tres" id="5_wb47d"]
[ext_resource type="Resource" uid="uid://bx61rbuwillgh" path="res://addons/top_down/resources/global_resources/graphics_resource.tres" id="6_dusoo"]
[ext_resource type="Material" uid="uid://chv0fg62cs0ou" path="res://addons/top_down/resources/materials/h_split.material.tres" id="11_6j0ru"]
[ext_resource type="Script" path="res://addons/top_down/scripts/game/MusicSetter.gd" id="12_dpfl3"]
Expand Down Expand Up @@ -45,6 +46,7 @@ focused_node = {
"graphics": NodePath("../MarginContainer/Control/Body/GraphicsMenu/Fullscreen/Button"),
"options": NodePath("../MarginContainer/Control/Body/OptionMenu/Graphics/Button")
}
back_sound = ExtResource("5_wb47d")

[node name="AudioManager" type="Node" parent="." node_paths=PackedStringArray("slider_container", "save_button")]
script = ExtResource("2_43xlx")
Expand Down Expand Up @@ -95,18 +97,11 @@ size_flags_vertical = 3
size_flags_stretch_ratio = 2.0

[node name="Label" type="Label" parent="MarginContainer/Control/Header"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -47.5
offset_top = -11.5
offset_right = 47.5
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
layout_mode = 0
offset_left = 94.0
offset_top = 51.5
offset_right = 376.0
offset_bottom = 118.5
theme_override_font_sizes/font_size = 48
text = "COOL GAME"

Expand Down Expand Up @@ -177,6 +172,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/OptionMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/OptionMenu/Back" index="2"]
pressed_sound = null

[node name="GraphicsMenu" type="VBoxContainer" parent="MarginContainer/Control/Body"]
visible = false
layout_mode = 2
Expand Down Expand Up @@ -207,6 +205,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/ControlsMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/ControlsMenu/Back" index="2"]
pressed_sound = null

[node name="AudioMenu" type="VBoxContainer" parent="MarginContainer/Control/Body"]
visible = false
layout_mode = 2
Expand Down Expand Up @@ -249,6 +250,9 @@ layout_mode = 2
[node name="Label" parent="MarginContainer/Control/Body/AudioMenu/Back" index="1"]
text = "Back"

[node name="ButtonAnimation" parent="MarginContainer/Control/Body/AudioMenu/Back" index="2"]
pressed_sound = null

[connection signal="pressed" from="MarginContainer/Control/Body/TitleMenu/Options/Button" to="MenuTraverseManager" method="open" binds= ["options"]]
[connection signal="pressed" from="MarginContainer/Control/Body/OptionMenu/Graphics/Button" to="MenuTraverseManager" method="open" binds= ["graphics"]]
[connection signal="pressed" from="MarginContainer/Control/Body/OptionMenu/Audio/Button" to="MenuTraverseManager" method="open" binds= ["audio"]]
Expand Down
3 changes: 3 additions & 0 deletions addons/top_down/scripts/ui/ButtonAnimation.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends Node

@export var button:Button
@export var label:Label
@export var pressed_sound:SoundResource

var default_shader_parameters: = {
scale = 1.0,
Expand Down Expand Up @@ -74,6 +75,8 @@ func set_is_down(value:bool)->void:
is_down = value
if is_down:
set_style_tween(style_dictionary["pressed"])
if pressed_sound != null:
pressed_sound.play_managed()
elif is_focused:
set_style_tween(style_dictionary["focus"])
elif is_hover:
Expand Down
3 changes: 3 additions & 0 deletions addons/top_down/scripts/ui/title_screen/MenuManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extends Node
## Reference node that needs to be focused when specific directory is activated
@export var focused_node:Dictionary

@export var back_sound:SoundResource

## Use a dedicated resource for this task
var directory_resource:DictionaryDirectoryResource = DictionaryDirectoryResource.new()
Expand Down Expand Up @@ -65,3 +66,5 @@ func directory_grab_focus(value:String)->void:
## Sends method call to directory_resource
func back()->void:
directory_resource.directory_back()
if back_sound != null:
back_sound.play_managed()
1 change: 0 additions & 1 deletion kanban_tasks_data.kanban
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"uuid": "ed797cac-3c98-43ce-bdfd-b503f3fe384b",
"title": "Features",
"tasks": [
"d1c299ca-0770-48a3-8b13-44b7b8300ead",
"c83e05df-800b-4a07-a2dd-9baec83c3380",
"e0f8ddfd-5b24-46ad-9552-14eb3e22e82a",
"a5b31bad-1666-4183-9126-e94fe512886c",
Expand Down