1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2025-02-04 12:28:35 +00:00

Added AudioBus. SFX Vol slider now works

This commit is contained in:
hpham474
2021-11-07 20:33:07 -06:00
parent 9929aab354
commit 388fcb9483
11 changed files with 65 additions and 35 deletions

View File

@@ -13,11 +13,12 @@ func _ready():
music_slider.value = OptionsController.get_mus_volume()
func _on_Button_pressed():
$ButtonSFX.play()
AudioBus.emit_signal("button_clicked")
queue_free()
# MessageBus.emit_signal("change_scene", "Title")
#MessageBus.emit_signal("change_scene", "Title")
func _on_SFX_Slider_value_changed(value):
AudioBus.emit_signal("button_clicked")
OptionsController.set_sfx_vol(value)
OptionsController.save_options()
@@ -26,11 +27,11 @@ func _on_Volume_Slider_value_changed(value):
OptionsController.save_options()
func _on_Light_pressed():
AudioBus.emit_signal("button_clicked")
OptionsController.set_theme("light")
OptionsController.save_options()
$ButtonSFX.play()
func _on_Dark_pressed():
AudioBus.emit_signal("button_clicked")
OptionsController.set_theme("dark")
OptionsController.save_options()
$ButtonSFX.play()

View File

@@ -28,6 +28,7 @@ func set_mus_vol(volume):
emit_signal("change_mus_volume", mus_vol)
func set_sfx_vol(volume):
sfx_vol = volume
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), sfx_vol)
emit_signal("change_sfx_volume", sfx_vol)
#Option Save File
@@ -45,6 +46,7 @@ func load_options():
sfx_vol = f.get_var()
f.close()
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("BGM"), mus_vol)
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), sfx_vol)
# Getters
func get_theme():