function onBegin()
    player.ForceCameraUpdate = true
    setCameraOffset(1, 0)

    disableMovement()
    disableRetry()
    jump()
    run(50)
    walk(90)
    jump()
    walk(70)
    player.ForceCameraUpdate = false
    wait(0.6)
    walk(-10)
    wait(1.2)
    player.ForceCameraUpdate = true
    walk(64)
    -- enableMovement()
    -- wait(0.5)
    -- disableMovement()
    wait(1)
    dashRight()
    walk(10)
    jump(1)
    wait(0.2)
    dashUp()
    walk(17)
    wait(0.2)
    jump()
    wait(0.1)
    waitUntilOnGround()
    walk(20)
    jump()
    walk(30)
    wait(1.5)
    jump(1)
    walk(30)
    enableMovement()
end

function onEnd(room, wasSkipped) 
    enableMovement()
    enableRetry()
end

function dashUp()
    celeste.SaveData.Instance.Assists.DashAssist = false
    celeste.Input.Rumble(celeste.RumbleStrength.Strong, celeste.RumbleLength.Medium)
    monocle.MInput.Disabled = true
    player.OverrideDashDirection = vector2(0, -1)
    player.StateMachine.Locked = false
    player.StateMachine.State = player:StartDash()
    player.Dashes = 0
    wait(0.1)
    while (player.Speed.Y < 0) do -- Waits till maddy stops moving up
      player.Dashes = 0
      celeste.Input.MoveY.Value = -1
      celeste.Input.MoveX.Value = 0
      wait()
    end
    player.OverrideDashDirection = nil
    player.StateMachine.State = 11
    player.StateMachine.Locked = true
    monocle.MInput.Disabled = false
    waitUntilOnGround()
end

function dashRight()
    celeste.SaveData.Instance.Assists.DashAssist = false
    celeste.Input.Rumble(celeste.RumbleStrength.Strong, celeste.RumbleLength.Medium)
    monocle.MInput.Disabled = true
    player.OverrideDashDirection = vector2(1, 0)
    player.StateMachine.Locked = false
    player.StateMachine.State = player:StartDash()
    player.Dashes = 0
    wait(0.1)
    while (player.Speed.X > 0) do -- Waits till maddy stops moving up
      player.Dashes = 0
      celeste.Input.MoveY.Value = 1
      celeste.Input.MoveX.Value = 0
      wait()
    end
    player.OverrideDashDirection = nil
    player.StateMachine.State = 11
    player.StateMachine.Locked = true
    monocle.MInput.Disabled = false
    player.DummyGravity = false
    player.DummyAutoAnimate = false -- Remove this if you want Madeline to wobble while in midair, this will stop her from animating
end