From 16dee66c2e714ce30d477f52423396d2b7f54929 Mon Sep 17 00:00:00 2001 From: hpham474 Date: Sun, 7 Nov 2021 20:53:08 -0600 Subject: [PATCH] Bugfix: audio now plays when changing scenes; added audio to ships being interacted --- godot_ship/script/game/Gameplay.gd | 1 + godot_ship/script/game/moveShip.gd | 4 +++- godot_ship/script/title screen/Title Screen.gd | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/godot_ship/script/game/Gameplay.gd b/godot_ship/script/game/Gameplay.gd index 5c3808e..2ff36b6 100644 --- a/godot_ship/script/game/Gameplay.gd +++ b/godot_ship/script/game/Gameplay.gd @@ -16,5 +16,6 @@ func _ready(): func _on_Forfeit_pressed(): + AudioBus.emit_signal("button_clicked") queue_free(); MessageBus.emit_signal("change_scene", "Title") diff --git a/godot_ship/script/game/moveShip.gd b/godot_ship/script/game/moveShip.gd index b7bb2dd..a64aba7 100644 --- a/godot_ship/script/game/moveShip.gd +++ b/godot_ship/script/game/moveShip.gd @@ -18,9 +18,10 @@ var click_radius = 16 var orient = 0; func _input(event): - if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: + if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: if (event.position - position).length() < click_radius: if not held and event.pressed: + AudioBus.emit_signal("button_clicked") held = true; if held and not event.pressed: @@ -106,6 +107,7 @@ func _input(event): if checkOriginalPos(): return else: + AudioBus.emit_signal("button_clicked") if originalPos == null: if position == originalPos: return diff --git a/godot_ship/script/title screen/Title Screen.gd b/godot_ship/script/title screen/Title Screen.gd index e1e92ea..af2512d 100644 --- a/godot_ship/script/title screen/Title Screen.gd +++ b/godot_ship/script/title screen/Title Screen.gd @@ -5,17 +5,21 @@ func _ready(): $VBoxContainer/Singleplayer.grab_focus() func _on_Singleplayer_pressed(): + AudioBus.emit_signal("button_clicked") MessageBus.emit_signal("change_scene", "Singleplayer") queue_free() func _on_Multiplayer_pressed(): + AudioBus.emit_signal("button_clicked") MessageBus.emit_signal("change_scene", "Multiplayer") queue_free() func _on_Options_pressed(): + AudioBus.emit_signal("button_clicked") MessageBus.emit_signal("change_scene", "Options") queue_free() func _on_Quit_pressed(): + AudioBus.emit_signal("button_clicked") MessageBus.emit_signal("quit") queue_free()