mirror of
				https://github.com/JohnBreaux/Boat-Battle.git
				synced 2025-02-04 12:28:35 +00:00 
			
		
		
		
	Added signal for audio SFX
This commit is contained in:
		@@ -1,3 +1,3 @@
 | 
				
			|||||||
source_md5="aa361943427692c39cd21430895a1f89"
 | 
					source_md5="aa361943427692c39cd21430895a1f89"
 | 
				
			||||||
dest_md5="a384b01bb3a48f53f019cb11e44e2019"
 | 
					dest_md5="71290af628a880e44134b3636fc49535"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							@@ -1,3 +1,3 @@
 | 
				
			|||||||
source_md5="4121e74ab010d628490c26ed5391a8f1"
 | 
					source_md5="4121e74ab010d628490c26ed5391a8f1"
 | 
				
			||||||
dest_md5="e6145a1ff71559de29a79fa4b0b0fee2"
 | 
					dest_md5="8556f1ced20c3b073ae4fcb8a300e349"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							@@ -1,3 +1,3 @@
 | 
				
			|||||||
source_md5="d71fa2832e0ad78e94bbd353bc53c2bf"
 | 
					source_md5="d71fa2832e0ad78e94bbd353bc53c2bf"
 | 
				
			||||||
dest_md5="87d33fdc866cbaaee42f97113a36ceac"
 | 
					dest_md5="e694209bc2af13019893f9a931b65aae"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							@@ -11,5 +11,5 @@ dest_files=[ "res://.import/HitSFX.ogg-93a1e93085ac0a2fc2e723f5d44a2ca9.oggstr"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[params]
 | 
					[params]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loop=true
 | 
					loop=false
 | 
				
			||||||
loop_offset=0
 | 
					loop_offset=0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,5 +11,5 @@ dest_files=[ "res://.import/MissSFX.ogg-d7b93821aa1c2b607fa4dc4bb3561322.oggstr"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[params]
 | 
					[params]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loop=true
 | 
					loop=false
 | 
				
			||||||
loop_offset=0
 | 
					loop_offset=0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,5 +11,5 @@ dest_files=[ "res://.import/SunkSFX.ogg-52b6d419298328defecfc61b6c15659d.oggstr"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[params]
 | 
					[params]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loop=true
 | 
					loop=false
 | 
				
			||||||
loop_offset=0
 | 
					loop_offset=0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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://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://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/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"]
 | 
					[node name="Control" type="Control"]
 | 
				
			||||||
anchor_right = 1.0
 | 
					anchor_right = 1.0
 | 
				
			||||||
@@ -20,3 +23,15 @@ bus = "BGM"
 | 
				
			|||||||
[node name="buttonSFX" type="AudioStreamPlayer" parent="."]
 | 
					[node name="buttonSFX" type="AudioStreamPlayer" parent="."]
 | 
				
			||||||
stream = ExtResource( 3 )
 | 
					stream = ExtResource( 3 )
 | 
				
			||||||
bus = "SFX"
 | 
					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"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,3 +6,6 @@ extends Node
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Ask for a scene change
 | 
					# Ask for a scene change
 | 
				
			||||||
signal button_clicked
 | 
					signal button_clicked
 | 
				
			||||||
 | 
					signal ship_hit
 | 
				
			||||||
 | 
					signal ship_missed
 | 
				
			||||||
 | 
					signal ship_sunk
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,9 +9,22 @@ extends Control
 | 
				
			|||||||
func _ready():
 | 
					func _ready():
 | 
				
			||||||
	var _errno = 0
 | 
						var _errno = 0
 | 
				
			||||||
	_errno += AudioBus.connect("button_clicked", self, "_button_clicked")
 | 
						_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():
 | 
					func _button_clicked():
 | 
				
			||||||
	$buttonSFX.play()
 | 
						$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.
 | 
					# Called every frame. 'delta' is the elapsed time since the previous frame.
 | 
				
			||||||
#func _process(delta):
 | 
					#func _process(delta):
 | 
				
			||||||
#	pass
 | 
					#	pass
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user