diff options
author | heav <hheav3@gmail.com> | 2023-03-26 22:31:34 +0000 |
---|---|---|
committer | heav <hheav3@gmail.com> | 2023-03-26 22:31:34 +0000 |
commit | 83269236d4f9271d0cd5e4acefc852d9ef381a46 (patch) | |
tree | 747fe870eee7f383ed62ad2da6ba5f8e79df6a94 | |
parent | 9bdb5bc1ffb2081dd59a2191e3028b9ecea8eafc (diff) |
made the game 34561x more optimal.
-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 |