local dir = "bgs/busstop/" -- CHANGE THE DIRECTORY IF NEED BE

local sprites = {
    "back",
    "buildings_back",
    "bush_back",
    "shelter",
    "bench",
    "bench_overlay",
    "pumkin",
    "light"
}

function onCreate()
    for i = 1, #sprites, 1 do
        makeLuaSprite(sprites[i], dir..sprites[i], 0, 0)
        addLuaSprite(sprites[i])
    end

    setBlendMode("light", "add")
    setProperty("light.alpha", 0.15)

    setBlendMode("bench_overlay", "add")
    setProperty("bench_overlay.alpha", 0.1)

    setProperty("back.x", -75)
    setProperty("back.y", -75)

    setScrollFactor("back", 0.25, 0.25)
    setScrollFactor("buildings_back", 0.5, 0.5)
    setScrollFactor("bush_back", 0.9, 0.9)

    scaleObject('back', 1.25, 1.25)
    scaleObject('buildings_back', 1.25, 1.25)
    scaleObject('bush_back', 1.25, 1.25)
    scaleObject('shelter', 1.25, 1.25)
    scaleObject('bench', 1.25, 1.25)
    scaleObject('bench_overlay', 1.25, 1.25)
    scaleObject('pumkin', 1.25, 1.25)
    scaleObject('light', 1.25, 1.25)

    setObjectOrder("light", 99)
    -- commented out because it makes it look really muddy and bad
    
    -- makeLuaSprite("light_overlay", nil, 0, 0)
    -- makeGraphic("light_overlay", 1280, 720, "fffbe1")
    -- setObjectCamera("light_overlay", "hud")
    -- setBlendMode("light_overlay", "add")
    -- setProperty("light_overlay.alpha", 0.15)
    -- addLuaSprite("light_overlay")

    makeLuaSprite('car',dir..'car',1750,500)
    scaleObject('car', 1.25,1.25)
    addLuaSprite('car',true)
    setScrollFactor('car',1.2,1.2)
end

function onCreatePost()
    -- hide opponent notes
    for i = 0, 3 do
        setPropertyFromGroup('opponentStrums', i, 'x', 9999)
    end

    -- make garcello appear on top of alien
    setObjectOrder('boyfriendGroup', getObjectOrder('dadGroup') - 1)
end

function moveCar()

    cancelTween('tweenCar')

    setProperty('car.x',1750)

    doTweenX('tweenCar','car',-2000,0.2)
end

function onEvent(event, value1, value2, strumTime)
    if event == 'busStopCar' then
        moveCar()
    end
end