From 51e230117a207a21b90552031daf83a23e196cd1 Mon Sep 17 00:00:00 2001 From: hpham474 Date: Sat, 13 Nov 2021 23:55:46 -0600 Subject: [PATCH] Added signal for audio SFX --- ...X.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 | 2 +- ...gg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr | Bin 8911 -> 8899 bytes ...X.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 | 2 +- ...gg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr | Bin 43971 -> 43959 bytes ...X.ogg-52b6d419298328defecfc61b6c15659d.md5 | 2 +- ...gg-52b6d419298328defecfc61b6c15659d.oggstr | Bin 29439 -> 29427 bytes godot_ship/assets/audio/HitSFX.ogg.import | 2 +- godot_ship/assets/audio/MissSFX.ogg.import | 2 +- godot_ship/assets/audio/SunkSFX.ogg.import | 2 +- godot_ship/scenes/AudioController.tscn | 17 ++++++++++++++++- .../script/audio controller/Audio Bus.gd | 3 +++ .../audio controller/AudioController.gd | 13 +++++++++++++ 12 files changed, 38 insertions(+), 7 deletions(-) diff --git a/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 index dd2febb..dc35f36 100644 --- a/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 +++ b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.md5 @@ -1,3 +1,3 @@ source_md5="aa361943427692c39cd21430895a1f89" -dest_md5="a384b01bb3a48f53f019cb11e44e2019" +dest_md5="71290af628a880e44134b3636fc49535" diff --git a/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr b/godot_ship/.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr index 0d5b2793ff2d555d48127164f53c4a472842c9d5..5261971fd44889c585ac872f896086e56273e44c 100644 GIT binary patch delta 19 acmX@_df0UXJ0m0GW)8;fiY!6FLCyd`v<0aE delta 31 jcmX@?dfs&dJ0m00W)8;fiUQ0G3=B*_%m~Cm!9mUdcLN2y diff --git a/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 index 93ca95d..90af281 100644 --- a/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 +++ b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.md5 @@ -1,3 +1,3 @@ source_md5="4121e74ab010d628490c26ed5391a8f1" -dest_md5="e6145a1ff71559de29a79fa4b0b0fee2" +dest_md5="8556f1ced20c3b073ae4fcb8a300e349" diff --git a/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr b/godot_ship/.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr index e3ddb9aab69cca80856bc07e6424314458518377..dbb57d5b7629b133a59a92398ae61e56df83a9c8 100644 GIT binary patch delta 21 dcmX?nooV}ZrVZ?jjEtK(7+0@i2?`E!1^`-A2Q~lz delta 33 mcmdmfo$2s(rVZ?jj7*z37+0?nU}j)oU;<)BAPx!+as~jSGY3fk diff --git a/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 index 6f77432..aa69243 100644 --- a/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 +++ b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.md5 @@ -1,3 +1,3 @@ source_md5="d71fa2832e0ad78e94bbd353bc53c2bf" -dest_md5="87d33fdc866cbaaee42f97113a36ceac" +dest_md5="e694209bc2af13019893f9a931b65aae" diff --git a/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr b/godot_ship/.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr index f3bc4717d00476505db16e268565f1ae73d3ae44..c10859e82266ba6bdfd4e4b3edda9a723bf49e1f 100644 GIT binary patch delta 21 dcmezWl=1UZ#trO@jEtK(7@rri1O*2<0{~^I2g?8e delta 33 mcmezTl=1&l#trO@j7*z37@rpkFf%YPFaa?m5C;VZIRgN-ga_UL diff --git a/godot_ship/assets/audio/HitSFX.ogg.import b/godot_ship/assets/audio/HitSFX.ogg.import index f39b0c1..7f85105 100644 --- a/godot_ship/assets/audio/HitSFX.ogg.import +++ b/godot_ship/assets/audio/HitSFX.ogg.import @@ -11,5 +11,5 @@ dest_files=[ "res://.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr" [params] -loop=true +loop=false loop_offset=0 diff --git a/godot_ship/assets/audio/MissSFX.ogg.import b/godot_ship/assets/audio/MissSFX.ogg.import index 5689c33..8767d4e 100644 --- a/godot_ship/assets/audio/MissSFX.ogg.import +++ b/godot_ship/assets/audio/MissSFX.ogg.import @@ -11,5 +11,5 @@ dest_files=[ "res://.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr" [params] -loop=true +loop=false loop_offset=0 diff --git a/godot_ship/assets/audio/SunkSFX.ogg.import b/godot_ship/assets/audio/SunkSFX.ogg.import index df8f7c6..17cd2ab 100644 --- a/godot_ship/assets/audio/SunkSFX.ogg.import +++ b/godot_ship/assets/audio/SunkSFX.ogg.import @@ -11,5 +11,5 @@ dest_files=[ "res://.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr" [params] -loop=true +loop=false loop_offset=0 diff --git a/godot_ship/scenes/AudioController.tscn b/godot_ship/scenes/AudioController.tscn index 5de3d12..c4112e2 100644 --- a/godot_ship/scenes/AudioController.tscn +++ b/godot_ship/scenes/AudioController.tscn @@ -1,8 +1,11 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://assets/audio/BGM - Captain Scurvy.ogg" type="AudioStream" id=1] [ext_resource path="res://script/audio controller/AudioController.gd" type="Script" id=2] [ext_resource path="res://assets/audio/ButtonSFX.ogg" type="AudioStream" id=3] +[ext_resource path="res://assets/audio/HitSFX.ogg" type="AudioStream" id=4] +[ext_resource path="res://assets/audio/MissSFX.ogg" type="AudioStream" id=5] +[ext_resource path="res://assets/audio/SunkSFX.ogg" type="AudioStream" id=6] [node name="Control" type="Control"] anchor_right = 1.0 @@ -20,3 +23,15 @@ bus = "BGM" [node name="buttonSFX" type="AudioStreamPlayer" parent="."] stream = ExtResource( 3 ) bus = "SFX" + +[node name="shipHitSFX" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 4 ) +bus = "SFX" + +[node name="shipMissedSFX" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 5 ) +bus = "SFX" + +[node name="shipSunkSFX" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 6 ) +bus = "SFX" diff --git a/godot_ship/script/audio controller/Audio Bus.gd b/godot_ship/script/audio controller/Audio Bus.gd index 4fbe1d1..dac0314 100644 --- a/godot_ship/script/audio controller/Audio Bus.gd +++ b/godot_ship/script/audio controller/Audio Bus.gd @@ -6,3 +6,6 @@ extends Node # Ask for a scene change signal button_clicked +signal ship_hit +signal ship_missed +signal ship_sunk diff --git a/godot_ship/script/audio controller/AudioController.gd b/godot_ship/script/audio controller/AudioController.gd index a128649..193e0a6 100644 --- a/godot_ship/script/audio controller/AudioController.gd +++ b/godot_ship/script/audio controller/AudioController.gd @@ -9,9 +9,22 @@ extends Control func _ready(): var _errno = 0 _errno += AudioBus.connect("button_clicked", self, "_button_clicked") + _errno += AudioBus.connect("ship_hit", self, "_ship_hit") + _errno += AudioBus.connect("ship_missed", self, "_ship_missed") + _errno += AudioBus.connect("ship_sunk", self, "_ship_sunk") func _button_clicked(): $buttonSFX.play() + +func _ship_hit(): + $shipHitSFX.play() + +func _ship_missed(): + $shipMissedSFX.play() + +func _ship_sunk(): + $shipSunkSFX.play() + # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass