local coroutineEntity = monocle.Entity()

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

function onBegin(room)
  walkTo(5208)
  wait(0.2)
  coroutine.yield(celeste.CutsceneEntity.CameraTo(vector2(5048, 20), 2, monocle.Ease.SineInOut))
  wait(0.5)
  coroutine.yield(getLevel():ZoomTo(vector2(160, 110), 1.7, 1.5))
  wait(0.5)
  setFlag("activateFloat1First", True)
  wait(0.2)
  playSound("event:/game/05_mirror_temple/crystaltheo_break_free", player.Position)
  setFlag("activateFloat1", True)
  wait(2)
  coroutine.yield(celeste.CutsceneEntity.CameraTo(vector2(5048,-240), 2.5, monocle.Ease.SineInOut))
  coroutine.yield(engine.Scene:ZoomBack(1.75))
end

function onEnd(room, wasSkipped)
  enableMovement()
  setFlag("activateFloat1First", True)
  setFlag("activateFloat1", True)
  player.DummyAutoAnimate = true
  player.ForceCameraUpdate = true
  getLevel():ResetZoom()
  enableMovement()
    if wasSkipped then
    setFlag("activateFloat1First", True)
    setFlag("activateFloat1", True)
    player.DummyAutoAnimate = true
    player.ForceCameraUpdate = true
    getLevel():ResetZoom()
    enableMovement()
    end
end