1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-14 21:15:58 +00:00

Background music volume can be adjusted

This commit is contained in:
hpham474 2021-11-01 04:48:21 -05:00
parent 1b3333203e
commit bc319fa464
5 changed files with 8 additions and 20 deletions

View File

@ -18,7 +18,7 @@ config/icon="res://icon.png"
MessageBus="*res://script/game/Message Bus.gd"
OptionsController="*res://script/options/OptionsController.gd"
AudioController="*res://scenes/AudioController.tscn"
AudioController="*res://scenes/BackgroundMusic.tscn"
[display]

View File

@ -1,12 +1,10 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://BGM - Captain Scurvy.ogg" type="AudioStream" id=1]
[ext_resource path="res://script/audio controller/AudioController.gd" type="Script" id=2]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -68,6 +68,8 @@ focus_neighbour_top = NodePath("../../../Back")
focus_neighbour_bottom = NodePath("../../Volume Setting/Volume Slider")
focus_next = NodePath("../../Volume Setting/Volume Slider")
focus_previous = NodePath("../../../Back")
min_value = -80.0
max_value = 0.0
step = 10.0
tick_count = 11
__meta__ = {
@ -98,6 +100,8 @@ focus_neighbour_top = NodePath("../../SFX Setting/SFX Slider")
focus_neighbour_bottom = NodePath("../../../Buttons/Dark")
focus_next = NodePath("../../../Buttons/Dark")
focus_previous = NodePath("../../SFX Setting/SFX Slider")
min_value = -80.0
max_value = 0.0
step = 10.0
tick_count = 11
ticks_on_borders = true

View File

@ -1,16 +0,0 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -24,6 +24,7 @@ func set_theme(theme_name):
emit_signal("change_theme", theme)
func set_mus_vol(volume):
mus_vol = volume
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), mus_vol)
emit_signal("change_mus_volume", mus_vol)
func set_sfx_vol(volume):
sfx_vol = volume
@ -43,6 +44,7 @@ func load_options():
mus_vol = f.get_var()
sfx_vol = f.get_var()
f.close()
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), mus_vol)
# Getters
func get_theme():