73 lines
1.9 KiB
Lua
73 lines
1.9 KiB
Lua
local myTypes = require("modules.types")
|
|
|
|
local cd = math.random(10, 25)
|
|
|
|
local train
|
|
|
|
local trainPassing = false
|
|
local passing
|
|
|
|
local stage = {
|
|
|
|
}
|
|
|
|
function stage.onCreate()
|
|
local bg = myTypes.Image("images/philly/sky.png")
|
|
bg.resize = myTypes.Vector2(1.5, 1.5)
|
|
bg.modifier = 0.1
|
|
bg.position = myTypes.Vector2(-300)
|
|
|
|
local city = myTypes.Image("images/philly/city.png")
|
|
city.resize = myTypes.Vector2(1.5, 1.5)
|
|
city.modifier = 0.4
|
|
city.position = myTypes.Vector2(-300)
|
|
|
|
local windows = myTypes.Image("images/philly/window.png")
|
|
windows.resize = myTypes.Vector2(1.5, 1.5)
|
|
windows.modifier = 0.4
|
|
windows.position = myTypes.Vector2(-300)
|
|
|
|
local behindTrain = myTypes.Image("images/philly/behindTrain.png")
|
|
behindTrain.resize = myTypes.Vector2(1.5, 1.5)
|
|
behindTrain.position = myTypes.Vector2(-885)
|
|
|
|
train = myTypes.Image("images/philly/train.png")
|
|
train.position = myTypes.Vector2(2000, 600)
|
|
|
|
local street = myTypes.Image("images/philly/street.png")
|
|
street.resize = myTypes.Vector2(1.5, 1.5)
|
|
street.position = myTypes.Vector2(-885)
|
|
|
|
passing = love.audio.newSource("sounds/philly/train_passes.ogg", "static")
|
|
end
|
|
|
|
function stage.onBeat(beat)
|
|
if not trainPassing then
|
|
cd = cd - 1
|
|
if cd == 0 then
|
|
cd = math.random(10, 25)
|
|
train.position = myTypes.Vector2(2000, 600)
|
|
trainPassing = true
|
|
stage.characters.gf:PlayAnimation("hairBlow")
|
|
-- passing:play()
|
|
end
|
|
end
|
|
end
|
|
|
|
function stage.onUpdate(dt)
|
|
if trainPassing then
|
|
train.position.x = train.position.x - 5000 * dt
|
|
if train.position.x < -4000 then
|
|
trainPassing = false
|
|
stage.characters.gf:PlayAnimation("hairFall")
|
|
end
|
|
end
|
|
end
|
|
|
|
function stage.onClose()
|
|
passing:stop()
|
|
passing:release()
|
|
passing = nil
|
|
end
|
|
|
|
return stage |