shard sound set to own bus and channel (fixes #53) (fixes #54)

This commit is contained in:
pennyrigate 2023-02-26 17:05:11 -05:00
parent 1b7d93195f
commit d802ce13b7
6 changed files with 33 additions and 7 deletions

View file

@ -2,12 +2,13 @@ extends Node
#Audio Channels
onready var ac_jump = $JumpSound
onready var ac_collectible = $CollecitbleSound
onready var ac_collectible = $CollectibleSound
onready var ac_climb = $ClimbSound
onready var ac_die = $DieSound
onready var ac_music = $Music
onready var ac_cheat = $CodeEntrySound
onready var ac_boss = $BossSound
onready var ac_shard = $ShardSound
#Sounds
const a_gold = preload("res://audio/sounds/gold.wav")
const a_arrow = preload("res://audio/sounds/a_egg_collect.ogg")
@ -36,3 +37,15 @@ func play_sound(snd,player):
func play_music(song):
if Audio.ac_music.stream != song or Audio.ac_music.playing == false:
play_sound(song,ac_music)
#Play shard sound, this silences all other sounds including music until the sound ends
func play_shard_sound():
var idx = AudioServer.get_bus_index("sound")
AudioServer.set_bus_mute(idx, true)
ac_music.set_stream_paused(true)
play_sound(a_shard,ac_shard)
func _on_ShardSound_finished():
var idx = AudioServer.get_bus_index("sound")
AudioServer.set_bus_mute(idx, false)
ac_music.set_stream_paused(false)