1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-15 05:25:57 +00:00

Added signal for audio SFX

This commit is contained in:
hpham474 2021-11-13 23:55:46 -06:00
parent 3b7a8afdf8
commit 51e230117a
12 changed files with 38 additions and 7 deletions

View File

@ -1,3 +1,3 @@
source_md5="aa361943427692c39cd21430895a1f89"
dest_md5="a384b01bb3a48f53f019cb11e44e2019"
dest_md5="71290af628a880e44134b3636fc49535"

View File

@ -1,3 +1,3 @@
source_md5="4121e74ab010d628490c26ed5391a8f1"
dest_md5="e6145a1ff71559de29a79fa4b0b0fee2"
dest_md5="8556f1ced20c3b073ae4fcb8a300e349"

View File

@ -1,3 +1,3 @@
source_md5="d71fa2832e0ad78e94bbd353bc53c2bf"
dest_md5="87d33fdc866cbaaee42f97113a36ceac"
dest_md5="e694209bc2af13019893f9a931b65aae"

View File

@ -11,5 +11,5 @@ dest_files=[ "res://.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr"
[params]
loop=true
loop=false
loop_offset=0

View File

@ -11,5 +11,5 @@ dest_files=[ "res://.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr"
[params]
loop=true
loop=false
loop_offset=0

View File

@ -11,5 +11,5 @@ dest_files=[ "res://.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr"
[params]
loop=true
loop=false
loop_offset=0

View File

@ -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"

View File

@ -6,3 +6,6 @@ extends Node
# Ask for a scene change
signal button_clicked
signal ship_hit
signal ship_missed
signal ship_sunk

View File

@ -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