mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-04-11 20:02:56 -05:00
Now BGM only loads if it exists
This commit is contained in:
parent
633961763a
commit
3487308388
26
load/bgm.lua
26
load/bgm.lua
@ -1,10 +1,30 @@
|
||||
bgm = {
|
||||
bgm_paths = {
|
||||
credit_roll = {
|
||||
gm3 = love.audio.newSource("res/bgm/tgm_credit_roll.mp3", "stream"),
|
||||
gm3 = "res/bgm/tgm_credit_roll.mp3",
|
||||
},
|
||||
pacer_test = love.audio.newSource("res/bgm/pacer_test.mp3", "stream"),
|
||||
pacer_test = "res/bgm/pacer_test.mp3",
|
||||
}
|
||||
|
||||
bgm = {}
|
||||
|
||||
for k,v in pairs(bgm_paths) do
|
||||
if(type(v) == "table") then
|
||||
-- list of subsounds
|
||||
for k2,v2 in pairs(v) do
|
||||
if(love.filesystem.getInfo(v2)) then
|
||||
-- this file exists
|
||||
bgm[k] = bgm[k] or {}
|
||||
bgm[k][k2] = love.audio.newSource(v2, "stream")
|
||||
end
|
||||
end
|
||||
else
|
||||
if(love.filesystem.getInfo(v)) then
|
||||
-- this file exists
|
||||
bgm[k] = love.audio.newSource(v, "stream")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local current_bgm = nil
|
||||
local bgm_locked = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user