local function doFadeWipe(state)
  fadeWipe = celeste.FadeWipe(engine.Scene, state, nil)
  engine.Scene:Add(fadeWipe)
  fadeWipe.duration = 2
  fadeWipe.EndTimer = 1
end


function onBegin()

  if getFlag("intreehouse") then

    disablePause()
    disableMovement()
    doFadeWipe(true)
    player.Facing = getEnum("Celeste.Facings", "Right")
    wait(1.5)

    setFlag("intreehouse", false)
    setFlag("entertreehouse", false)
    setFlag("treehouse", false)
    enableMovement()
    enablePause()

  end

end