local vector2 = require("#microsoft.xna.framework.vector2")
local exCameraHelper = require("#Celeste.Mod.ExCameraDynamics.Code.Module.ExCameraInterop")
local cameraFocus = require("#Celeste.Mod.ExCameraDynamics.Code.Entities.CameraFocus")
local cameraZoomHooks = require("#Celeste.Mod.ExCameraDynamics.Code.Hooks.CameraZoomHooks")

function onBegin()

    disableMovement()
    disablePause ()

    setDarkness(1)
    player.Facing = getEnum("Celeste.Facings", "Left")

    --local level = getLevel()
    --coroutine.yield(exCameraHelper.Level_ZoomToFocus(level, vector2(3240, 4508), 2, 0.001))

    player.DummyAutoAnimate = false
    player.Sprite:Play("sleep")
    
    local darkness = 1
    while (true) do
        wait(0.01)
        darkness = darkness - 0.01
        setDarkness (darkness)
        if darkness < 0.01 then
            break
        end
    end
    
    wait(1)
    player.DummyAutoAnimate = true
    wait(3)

    local level = getLevel()
    cameraZoomHooks.ForceCameraTo(level, cameraFocus.FromCenter(vector2(3760, 4324), 2))
    teleportTo(3766, 4360, "feel_08")

    enableMovement()
    enablePause ()
    endCutscene ()
	

end