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

function onBegin()
  player.Facing = getEnum("Celeste.Facings", "Right")
  disableRetry()
  disableMovement()
  player.ForceCameraUpdate = false
  wait(1)
  say("ending_appels_1")
  wait(0.25)
  coroutine.yield(celeste.CutsceneEntity.CameraTo(vector2(53320, -10044), 2.5))
  wait(0.3)
  local level = getLevel()
  level:add(coroutineEntity)
  -- These next 2 lines will run in parallel
  coroutineEntity:add(monocle.Coroutine(celeste.CutsceneEntity.CameraTo(vector2(53320, -10044), 3)))
  coroutineEntity:add(monocle.Coroutine(say("ending_appels_2")))
  player.ForceCameraUpdate = true
end

function onEnd()
  player.ForceCameraUpdate = true
  enableRetry()
  enableMovement()
end