local vector2 = require("#microsoft.xna.framework.vector2")
local exCameraHelper = require("#Celeste.Mod.ExCameraDynamics.Code.Module.ExCameraInterop")

function onBegin()

    disableMovement()
    disablePause ()

    local level = getLevel()
    coroutine.yield(exCameraHelper.Level_ZoomToFocus(level, vector2(656, 3732), 1, 0.01))

    player.Facing = getEnum("Celeste.Facings", "Left")
    setFlag("end", true)

    local darkness = getDarkness ()
    while (true) do
        wait(0.01)
        darkness = darkness - 0.02
        setDarkness (darkness)
        if darkness < 0.02 then
            break
        end
    end
    --0.5s
    wait(0.5)
    --0.5s
    walkTo (640, false, 0.6, false)
    --0.2s

    player.DummyAutoAnimate = false
    player.Sprite:Play("sitDown")

    wait(2)

    teleportTo(1160, 3792, "end_02")


    enablePause ()
    enableMovement()
    endCutscene ()
	

end