summaryrefslogtreecommitdiff
path: root/game/sfx.lua
diff options
context:
space:
mode:
Diffstat (limited to 'game/sfx.lua')
-rw-r--r--game/sfx.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/game/sfx.lua b/game/sfx.lua
new file mode 100644
index 0000000..291c945
--- /dev/null
+++ b/game/sfx.lua
@@ -0,0 +1,21 @@
+local sounds = {
+ "harddrop",
+}
+
+local sources = {}
+for _, soundname in ipairs(sounds) do
+ sources[soundname] = love.audio.newSource("assets/"..soundname..".mp3","static")
+end
+
+local M = {}
+
+function M.play(name)
+ if sources[name] then
+ sources[name]:seek(0)
+ sources[name]:play()
+ else
+ error("no such sound effect: "..name)
+ end
+end
+
+return M \ No newline at end of file