diff --git a/audio/sounds/confirm.wav b/audio/sounds/confirm.wav index f9f0742..b380175 100644 Binary files a/audio/sounds/confirm.wav and b/audio/sounds/confirm.wav differ diff --git a/menus/DeleteButton.gd b/menus/DeleteButton.gd index cac4c5e..4af4968 100644 --- a/menus/DeleteButton.gd +++ b/menus/DeleteButton.gd @@ -12,4 +12,3 @@ func _process(delta): func _gui_input(event): if event.is_action_pressed("ui_accept"): get_parent().set_kill_mode(!get_parent().kill_mode) - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) diff --git a/menus/back_button.gd b/menus/back_button.gd index 9ef8314..18327af 100644 --- a/menus/back_button.gd +++ b/menus/back_button.gd @@ -13,4 +13,3 @@ func _process(delta): func _gui_input(event): if event.is_action_pressed("ui_accept"): SceneManager.current_scene = next_scene.instance() - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) diff --git a/menus/file_select.gd b/menus/file_select.gd index 2a5d223..6b1d5bf 100644 --- a/menus/file_select.gd +++ b/menus/file_select.gd @@ -27,8 +27,7 @@ func set_kill_mode(value): description.text = "Select your destiny" flavor_text.text = "Adventure awaits" -#func play_select_sound(): -# Audio.play_sound(Audio.a_select,Audio.ac_collectible) -#func play_confirm_sound(): -# Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) + +func play_confirm_sound(): + pass # Replace with function body. diff --git a/menus/file_select.tscn b/menus/file_select.tscn index f597492..b0f81f4 100644 --- a/menus/file_select.tscn +++ b/menus/file_select.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=2] +[gd_scene load_steps=18 format=2] [ext_resource path="res://menus/file_select_panel.tscn" type="PackedScene" id=1] [ext_resource path="res://menus/level_select_scholar.tscn" type="PackedScene" id=2] @@ -13,6 +13,7 @@ [ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=11] [ext_resource path="res://menus/DeleteButton.gd" type="Script" id=12] [ext_resource path="res://menus/main_menu.tscn" type="PackedScene" id=13] +[ext_resource path="res://objects/hud/menu_sounds.tscn" type="PackedScene" id=14] [sub_resource type="ShaderMaterial" id=2] shader = ExtResource( 11 ) @@ -163,9 +164,21 @@ theme = ExtResource( 4 ) text = "Adventure awaits" align = 1 +[node name="MenuSounds" parent="." instance=ExtResource( 14 )] + [connection signal="file_loaded" from="Panel" to="." method="_on_file_loaded"] [connection signal="file_loaded" from="Panel2" to="." method="_on_file_loaded"] [connection signal="file_loaded" from="Panel3" to="." method="_on_file_loaded"] +[connection signal="focus_entered" from="SelectFile1" to="MenuSounds" method="play_select_sound"] [connection signal="pressed" from="SelectFile1" to="Panel" method="select"] +[connection signal="pressed" from="SelectFile1" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="SelectFile2" to="MenuSounds" method="play_select_sound"] [connection signal="pressed" from="SelectFile2" to="Panel2" method="select"] +[connection signal="pressed" from="SelectFile2" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="SelectFile3" to="MenuSounds" method="play_select_sound"] [connection signal="pressed" from="SelectFile3" to="Panel3" method="select"] +[connection signal="pressed" from="SelectFile3" to="MenuSounds" method="play_confirm_sound"] +[connection signal="button_down" from="Back" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="Back" to="MenuSounds" method="play_select_sound"] +[connection signal="button_down" from="DeleteButton" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="DeleteButton" to="MenuSounds" method="play_select_sound"] diff --git a/menus/file_select_panel.gd b/menus/file_select_panel.gd index 9855245..5c12640 100644 --- a/menus/file_select_panel.gd +++ b/menus/file_select_panel.gd @@ -17,7 +17,6 @@ func _ready(): func select() -> void: - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) if get_parent().kill_mode == false: # if a file exists, load and play it! if file: diff --git a/menus/main_menu.gd b/menus/main_menu.gd index 6657b49..f5ed47c 100644 --- a/menus/main_menu.gd +++ b/menus/main_menu.gd @@ -16,32 +16,26 @@ func _ready(): Vector2( 0.83205, 0.5547 ) -func play_select_sound(): - Audio.play_sound(Audio.a_select,Audio.ac_collectible) - func _on_Continue_button_down(): - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) Fade.fade_out(0.4) yield(Fade, "fade_finished") SceneManager.current_scene = load("res://menus/level_select_scholar.tscn").instance() func _on_FileSelect_button_down(): - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) Fade.fade_out(0.4) yield(Fade, "fade_finished") SceneManager.current_scene = load("res://menus/file_select.tscn").instance() func _on_Exit_button_down(): - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) Fade.fade_out(0.4) yield(Fade, "fade_finished") get_tree().quit() func _on_SoundTest_button_down(): - Audio.play_sound(Audio.a_confirm,Audio.ac_collectible) Fade.fade_out(0.4) yield(Fade, "fade_finished") SceneManager.current_scene = load("res://menus/sound_test.tscn").instance() + diff --git a/menus/main_menu.tscn b/menus/main_menu.tscn index aa2ffda..0f7fd7a 100644 --- a/menus/main_menu.tscn +++ b/menus/main_menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://ui/theme.tres" type="Theme" id=1] [ext_resource path="res://shaders/wibble_wobble.gdshader" type="Shader" id=2] @@ -8,6 +8,7 @@ [ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=6] [ext_resource path="res://graphics/hud/sg_menu_blink.png" type="Texture" id=7] [ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=8] +[ext_resource path="res://objects/hud/menu_sounds.tscn" type="PackedScene" id=9] [sub_resource type="ShaderMaterial" id=2] shader = ExtResource( 6 ) @@ -227,7 +228,20 @@ text = "Welcome to the future... 2083" align = 1 +[node name="MenuSounds" parent="." instance=ExtResource( 9 )] + [connection signal="button_down" from="Panel/Continue" to="." method="_on_Continue_button_down"] +[connection signal="button_down" from="Panel/Continue" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="Panel/Continue" to="MenuSounds" method="play_select_sound"] [connection signal="button_down" from="Panel/FileSelect" to="." method="_on_FileSelect_button_down"] +[connection signal="button_down" from="Panel/FileSelect" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="Panel/FileSelect" to="MenuSounds" method="play_select_sound"] +[connection signal="focus_entered" from="Panel/MarathonMode" to="MenuSounds" method="play_select_sound"] +[connection signal="focus_entered" from="Panel/Augmentations" to="MenuSounds" method="play_select_sound"] +[connection signal="focus_entered" from="Panel/Options" to="MenuSounds" method="play_select_sound"] [connection signal="button_down" from="Panel/SoundTest" to="." method="_on_SoundTest_button_down"] +[connection signal="button_down" from="Panel/SoundTest" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="Panel/SoundTest" to="MenuSounds" method="play_select_sound"] [connection signal="button_down" from="Panel/Exit" to="." method="_on_Exit_button_down"] +[connection signal="button_down" from="Panel/Exit" to="MenuSounds" method="play_confirm_sound"] +[connection signal="focus_entered" from="Panel/Exit" to="MenuSounds" method="play_select_sound"] diff --git a/objects/hud/menu_sounds.gd b/objects/hud/menu_sounds.gd new file mode 100644 index 0000000..8b3ab81 --- /dev/null +++ b/objects/hud/menu_sounds.gd @@ -0,0 +1,12 @@ +extends Node + +var can_play: bool = false + +func play_select_sound(): + if can_play: + $"%SelectSound".play() + else: + can_play = true + +func play_confirm_sound(): + $"%ConfirmSound".play() diff --git a/objects/hud/menu_sounds.tscn b/objects/hud/menu_sounds.tscn new file mode 100644 index 0000000..b776bd3 --- /dev/null +++ b/objects/hud/menu_sounds.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://objects/hud/menu_sounds.gd" type="Script" id=1] +[ext_resource path="res://audio/sounds/confirm.wav" type="AudioStream" id=2] +[ext_resource path="res://audio/sounds/select.wav" type="AudioStream" id=3] + +[node name="MenuSounds" type="Node"] +script = ExtResource( 1 ) + +[node name="SelectSound" type="AudioStreamPlayer" parent="."] +unique_name_in_owner = true +stream = ExtResource( 3 ) +volume_db = -8.0 + +[node name="ConfirmSound" type="AudioStreamPlayer" parent="."] +unique_name_in_owner = true +stream = ExtResource( 2 ) +volume_db = -8.0