summaryrefslogtreecommitdiff
path: root/game/sfx.lua
blob: cd6ae2ec52bb5c51fe3af1e517e39b0637f195f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local sounds = {
    "harddrop",
    "tspinsingle", "tspindouble", "tspintriple",
}

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