local spotlight = require("#Celeste.SpotlightWipe")
local screenwipe = require("#Celeste.ScreenWipe")

function onBegin()
  if not (getFlag("realend")) then
    disableMovement()
    disableRetry()
    wait(4)

    spotlight.FocusPoint = player.Position - getRoom().Camera.Position
    local wipe = spotlight(getRoom(), false)
    wipe.Duration = 2
    wait(wipe.Duration)

    teleportTo(19500,-936,"x-ending","None")
    setFlag("start", true)
  end
end

function onEnd()
  setFlag("realend", true)
  enableMovement()
  enableRetry()
end