local coroutineEntity = monocle.Entity()

local vector2 = require("#microsoft.xna.framework.vector2")

function onBegin(room)
  --disableMovement()
  --wait(0.5)
  --coroutine.yield(getLevel():ZoomTo(vector2(219, 132), 2.3, 1.5))
  --player.DummyAutoAnimate = false
  --wait(0.5)
  --player.Sprite:Play("sleep", false)
  --wait(10)
  --player.ForceCameraUpdate = true
  --wait(5)
  --coroutine.yield(celeste.CutsceneEntity.CameraTo(vector2(getLevel().Camera.Position.X, player.Position.Y - 350), 6.5))
  --wait(0.5)
  --coroutine.yield(getLevel():ZoomTo(vector2(160, 85), 2.3, 0.5))
  --walkTo(350, false, 0.55)
  if not getFlag("watchedCutsceneLunar1") then
  celeste.Audio.SetMusicParam("fade", 0)
  disableMovement()
  setFlag("lunarFirstPhase", true)
  wait(3)
  say("LunarFirstDia")
  wait(0.5)
  setFlag("lunarFirstPhase", false)
  setFlag("watchedCutsceneLunar1", true)
  celeste.Audio.SetMusicParam("fade", 1)
  end
end

function onEnd(room, wasSkipped)
  player.DummyAutoAnimate = true
  player.ForceCameraUpdate = true
  getLevel():ResetZoom()
  setFlag("lunarFirstPhase", false)
  setFlag("watchedCutsceneLunar1", true)
  celeste.Audio.SetMusicParam("fade", 1)
  enableMovement()
    if wasSkipped then
    player.DummyAutoAnimate = true
    player.ForceCameraUpdate = true
    getLevel():ResetZoom()
    setFlag("lunarFirstPhase", false)
    enableMovement()
    celeste.Audio.SetMusicParam("fade", 1)
    setFlag("watchedCutsceneLunar1", true)
    end
end