local coroutineEntity = monocle.Entity()

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

function onTalk()
log("hi")
  log("hi")
  disableMovement()
  setFlag("lunarFifthPhase", true)
  wait(3)
  say("LunarFifthDia")
  celeste.Audio.Play("event:/new_content/game/10_farewell/glitch_short")
  celeste.Glitch.Value = 0.3
  wait(0.2)
  celeste.Glitch.Value = 0
celeste.Audio.Play("event:/new_content/game/10_farewell/glitch_long")
celeste.Glitch.Value = 0.3
wait(0.2)
celeste.Glitch.Value = 0
wait(0.85)
celeste.Glitch.Value = 0.3
wait(0.2)
celeste.Glitch.Value = 0
  setFlag("lunarFinalPhase", true)
  wait(0.3)
  wait(1.4)
  celeste.Audio.Play("event:/new_content/game/10_farewell/glitch_short")
  celeste.Glitch.Value = 0.3
  wait(0.2)
  celeste.Glitch.Value = 0
  celeste.Audio.Play("event:/new_content/game/10_farewell/glitch_short")
  celeste.Glitch.Value = 0.3
  wait(0.2)
  celeste.Glitch.Value = 0
  wait(1.4)
celeste.Audio.Play("event:/new_content/game/10_farewell/glitch_medium")
celeste.Glitch.Value = 0.3
wait(0.2)
celeste.Glitch.Value = 0
wait(0.1)
wait(1.4)
celeste.Glitch.Value = 0.3
wait(0.2)
celeste.Glitch.Value = 0
wait(0.75)
  setFlag("lunarFifthPhase", false)
celeste.Audio.Play("event:/new_content/game/10_farewell/glitch_short")
celeste.Glitch.Value = 0.3
wait(0.2)
celeste.Glitch.Value = 0
  setFlag("lunarFinalPhase", false)
  setFlag("watchedCutsceneLunar5", true)
end

function onEnd(room, wasSkipped)
  player.DummyAutoAnimate = true
  player.ForceCameraUpdate = true
  getLevel():ResetZoom()
  setFlag("lunarFifthPhase", false)
  setFlag("watchedCutsceneLunar5", true)
  enableMovement()
    if wasSkipped then
    player.DummyAutoAnimate = true
    player.ForceCameraUpdate = true
    getLevel():ResetZoom()
    setFlag("lunarFifthPhase", false)
    enableMovement()
    setFlag("watchedCutsceneLunar5", true)
    setFlag("lunarFinalPhase", false)
    end
end