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

function onBegin()
    
    disableMovement()
    makeUnskippable ()

    setBloomStrength(0)

    local level = getLevel()
    coroutine.yield(exCameraHelper.Level_ZoomToFocus(level, vector2(656, 1876), 2, 0.01))
    --coroutine.yield(level:ZoomSnap(vector2(160, 90), 2))

    setDarkness (1)
    player.Facing = getEnum("Celeste.Facings", "Left")
    
    player.DummyAutoAnimate = false
    player.Sprite:Play("sleep")
    
    wait(2)
    
    local darkness = 1
    while (true) do
        wait(0.01)
        darkness = darkness - 0.1
        setDarkness (darkness)
        if darkness < 0.1 then
            break
        end
    end
    wait(1)

    say("WHE_NaCline_D_051")
    wait(0.5)

    player.DummyAutoAnimate = true
    wait(0.5)

    say("WHE_NaCline_D_05")
    
    enableMovement()
    endCutscene ()

end