50 lines
1.6 KiB
Lua
50 lines
1.6 KiB
Lua
local myTypes = require("modules.types")
|
|
local lightningCountdown = love.math.random(15, 20) --holy fuck
|
|
local mansion
|
|
local sounds
|
|
|
|
return {
|
|
onCreate = function(song)
|
|
mansion = myTypes.Sprite("sprites/spooky/halloween_bg.png", "sprites/spooky/halloween_bg.json")
|
|
mansion.resize = myTypes.Vector2(2,2)
|
|
mansion:PlayAnimation("halloweem bg", 1, false)
|
|
mansion.position = myTypes.Vector2(-400, -200)
|
|
|
|
for index, anim in next, mansion.quads do
|
|
for index, quad in next, anim do
|
|
quad.resize = myTypes.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)
|
|
|
|
game.characters.bf:PlayAnimation("scared")
|
|
game.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
|
|
} |