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

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