diff options
-rw-r--r-- | assets/harddrop.mp3 | bin | 0 -> 34128 bytes | |||
-rw-r--r-- | game/sfx.lua | 21 |
2 files changed, 21 insertions, 0 deletions
diff --git a/assets/harddrop.mp3 b/assets/harddrop.mp3 Binary files differnew file mode 100644 index 0000000..c7b9891 --- /dev/null +++ b/assets/harddrop.mp3 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 |