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

When interacting with something (object or ship) and SFX is played

This commit is contained in:
hpham474 2021-11-07 20:42:50 -06:00
parent 388fcb9483
commit a2a0607364
3 changed files with 9 additions and 0 deletions

View File

@ -17,4 +17,5 @@ func _ready():
func _on_Forfeit_pressed(): func _on_Forfeit_pressed():
queue_free(); queue_free();
AudioBus.emit_signal("button_clicked")
MessageBus.emit_signal("change_scene", "Title") MessageBus.emit_signal("change_scene", "Title")

View File

@ -21,6 +21,7 @@ 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 (event.position - position).length() < click_radius:
if not held and event.pressed: if not held and event.pressed:
AudioBus.emit_signal("button_clicked")
held = true; held = true;
if held and not event.pressed: if held and not event.pressed:
@ -106,6 +107,7 @@ func _input(event):
if checkOriginalPos(): if checkOriginalPos():
return return
else: else:
AudioBus.emit_signal("button_clicked")
if originalPos == null: if originalPos == null:
if position == originalPos: if position == originalPos:
return return
@ -194,12 +196,14 @@ func _input(event):
# pass # pass
func pickup(): func pickup():
#AudioBus.emit_signal("button_clicked")
if held: if held:
return return
mode = RigidBody2D.MODE_STATIC mode = RigidBody2D.MODE_STATIC
held = true held = true
func drop(impulse=Vector2.ZERO): func drop(impulse=Vector2.ZERO):
#AudioBus.emit_signal("button_clicked")
if held: if held:
mode = RigidBody2D.MODE_RIGID mode = RigidBody2D.MODE_RIGID
apply_central_impulse(impulse) apply_central_impulse(impulse)

View File

@ -5,17 +5,21 @@ func _ready():
$VBoxContainer/Singleplayer.grab_focus() $VBoxContainer/Singleplayer.grab_focus()
func _on_Singleplayer_pressed(): func _on_Singleplayer_pressed():
AudioBus.emit_signal("button_clicked")
MessageBus.emit_signal("change_scene", "Singleplayer") MessageBus.emit_signal("change_scene", "Singleplayer")
queue_free() queue_free()
func _on_Multiplayer_pressed(): func _on_Multiplayer_pressed():
AudioBus.emit_signal("button_clicked")
MessageBus.emit_signal("change_scene", "Multiplayer") MessageBus.emit_signal("change_scene", "Multiplayer")
queue_free() queue_free()
func _on_Options_pressed(): func _on_Options_pressed():
AudioBus.emit_signal("button_clicked")
MessageBus.emit_signal("change_scene", "Options") MessageBus.emit_signal("change_scene", "Options")
queue_free() queue_free()
func _on_Quit_pressed(): func _on_Quit_pressed():
AudioBus.emit_signal("button_clicked")
MessageBus.emit_signal("quit") MessageBus.emit_signal("quit")
queue_free() queue_free()