diff options
Diffstat (limited to 'client/audio')
| -rw-r--r-- | client/audio/sound.gd | 16 | ||||
| -rw-r--r-- | client/audio/sound.tscn | 4 | 
2 files changed, 20 insertions, 0 deletions
diff --git a/client/audio/sound.gd b/client/audio/sound.gd index ac30acf8..99bf692f 100644 --- a/client/audio/sound.gd +++ b/client/audio/sound.gd @@ -2,6 +2,7 @@  # Copyright 2024 nokoe  # Copyright 2024 tpart  # Copyright 2024 metamuffin +# Copyright 2024 BigBrotherNii  #  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU Affero General Public License as published by @@ -19,10 +20,25 @@ extends Node  @onready var click_sound = $UI/Click  @onready var hover_sound = $UI/Hover +@onready var music_node : Node = $Music  var item_sounds: Dictionary = {}  var item_id: int = 0 +func play_music(music : String): +	for stream in music_node.get_children(): +		stream.stop() +	 +	music_node.get_node(music).play() + +func set_volume(value:float): +	AudioServer.set_bus_volume_db(0, value) +	 +	if value == -30: +		AudioServer.set_bus_mute(0, true) +	else: +		AudioServer.set_bus_mute(0, false) +  func play_click():  	click_sound.play() diff --git a/client/audio/sound.tscn b/client/audio/sound.tscn index 3f2607c8..a8524e71 100644 --- a/client/audio/sound.tscn +++ b/client/audio/sound.tscn @@ -14,3 +14,7 @@ stream = ExtResource("2_mhrce")  [node name="Hover" type="AudioStreamPlayer" parent="UI"]  stream = ExtResource("3_qft2s") + +[node name="Music" type="Node" parent="."] + +[node name="MainMenu" type="AudioStreamPlayer" parent="Music"]  |