local function doFadeWipe(state)
  local Color = require("#Microsoft.Xna.Framework.Color")
  local screenWipe = require("#Celeste.ScreenWipe")
    fadeWipe = celeste.FadeWipe(engine.Scene, state, nil)
    engine.Scene:Add(fadeWipe)
    fadeWipe.duration = 8
    fadeWipe.EndTimer = 0
    screenWipe.WipeColor = Color.White
end


function onBegin()

  if getFlag("backtosapato") then

    disablePause()
    player.ForceCameraUpdate = true
    doFadeWipe(true)
    wait(4)

    local Color = require("#Microsoft.Xna.Framework.Color")
    celeste.ScreenWipe.WipeColor = Color.Black
    setFlag("backtosapato", false)
    enableMovement()
    enablePause()

  end

end