From 83269236d4f9271d0cd5e4acefc852d9ef381a46 Mon Sep 17 00:00:00 2001 From: heav Date: Sun, 26 Mar 2023 22:31:34 +0000 Subject: made the game 34561x more optimal. --- assets/harddrop.mp3 | Bin 0 -> 34128 bytes game/sfx.lua | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 assets/harddrop.mp3 create mode 100644 game/sfx.lua diff --git a/assets/harddrop.mp3 b/assets/harddrop.mp3 new file mode 100644 index 0000000..c7b9891 Binary files /dev/null and b/assets/harddrop.mp3 differ 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 -- cgit v1.2.3