51 lines
1.6 KiB
Lua
51 lines
1.6 KiB
Lua
|
|
local lightningCountdown = love.math.random(15, 20) --holy fuck
|
|
local mansion
|
|
local sounds
|
|
|
|
return {
|
|
onCreate = function(song)
|
|
mansion = Sprite("sprites/spooky/halloween_bg.png", "sprites/spooky/halloween_bg.json")
|
|
mansion.resize = Vector2(2,2)
|
|
mansion:PlayAnimation("halloweem bg", 1, false)
|
|
mansion.position = Vector2(-800, -400)
|
|
mansion.layer = -1
|
|
|
|
for index, anim in next, mansion.quads do
|
|
for index, quad in next, anim do
|
|
quad.resize = Vector2(1.4,1.4)
|
|
end
|
|
end
|
|
|
|
sounds = {love.audio.newSource("sounds/spooky/thunder_1.ogg", "static"), love.audio.newSource("sounds/spooky/thunder_2.ogg", "static")}
|
|
end,
|
|
|
|
onBeat = function(beat)
|
|
lightningCountdown = lightningCountdown - 1
|
|
if lightningCountdown == 0 then
|
|
mansion:PlayAnimation("halloweem bg lightning strike", 24, false)
|
|
|
|
sharedVars.characters.bf:PlayAnimation("scared")
|
|
sharedVars.characters.gf:PlayAnimation("scared")
|
|
|
|
lightningCountdown = love.math.random(15, 20)
|
|
|
|
local sound = sounds[math.random(1, 2)]
|
|
sound:stop()
|
|
sound:play()
|
|
end
|
|
end,
|
|
|
|
onUpdate = function()
|
|
if mansion.animation ~= "halloweem bg" and mansion.ended then
|
|
mansion:PlayAnimation("halloweem bg", 1, false)
|
|
end
|
|
end,
|
|
onClose = function()
|
|
for index, sound in next, sounds do
|
|
sound:stop()
|
|
sound:release()
|
|
sound = nil
|
|
end
|
|
end
|
|
} |