aboutsummaryrefslogtreecommitdiff
path: root/game/src/Autoload/SFX.gd
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-02-27 17:26:54 +0100
committer GitHub <noreply@github.com>2023-02-27 17:26:54 +0100
commit2062aaf394ee6581161add4bcb23076475e236ac (patch)
treeadb1a6e5fe4c7d06c778188961a6e660ee911413 /game/src/Autoload/SFX.gd
parent150c11376765af5dc0c180de9cf7bbcc8fa9b99b (diff)
Refactor SFX into a SoundManager (#45)
* Refactor SFX into a SoundManager Add SoundManager able to play arbitrary sound streams Make SoundManager use only one AudioStreamPlayer per bus Add StyleBoxWithSound Add Kenney UI Audio click3.wav Removed sound play via pressed signals in MainMenu Make Button_MainMenu pressed style StyleBoxWithSound with click3.wav sound * Add playing mp3 files by name to the SoundManager * Fix missing quotation
Diffstat (limited to 'game/src/Autoload/SFX.gd')
-rw-r--r--game/src/Autoload/SFX.gd20
1 files changed, 0 insertions, 20 deletions
diff --git a/game/src/Autoload/SFX.gd b/game/src/Autoload/SFX.gd
deleted file mode 100644
index 5299848..0000000
--- a/game/src/Autoload/SFX.gd
+++ /dev/null
@@ -1,20 +0,0 @@
-extends Node
-
-var _loaded_sfx = {}
-
-func _ready():
- var dir = DirAccess.open("res://audio/sfx/")
- for fname in dir.get_files():
- if fname.get_extension() == "ogg":
- _loaded_sfx[fname.get_basename()] = load("res://audio/sfx/" + fname) # SND-10
-
-# SND-7
-func play(sound):
- var player = AudioStreamPlayer.new()
- player.bus = "SFX"
- player.stream = _loaded_sfx[sound]
- add_child(player)
- player.play()
- await player.finished
- remove_child(player)
-