Getting Started

    // Add this as a new method
    private void UpdateState(GameTime gameTime)
    {
    }

    // Add this to the beginning of the Update method
    UpdateState(gameTime);
    // Add these as member variables
    // This represents what the dwarf is doing
    string state = "idle";
    float currentSpeed = 0;
    const float WALK_SPEED = .115f;


Rotating the Dwarf

    // Add this to the beginning of the Update method
    KeyboardState keyState = Keyboard.GetState();
    if (currentSpeed > 0)
    {
        dwarfPosition += (-Matrix.CreateTranslation(0, 0, currentSpeed)
            * rotation).Translation;
    }
    if (keyState.IsKeyDown(Keys.D))
    {
        rotation *=
            Matrix.CreateFromAxisAngle(Vector3.Up, -MathHelper.Pi / 25.0f);

    }
    if (keyState.IsKeyDown(Keys.A))
    {
        rotation *=
            Matrix.CreateFromAxisAngle(Vector3.Up, MathHelper.Pi / 25.0f);
    }

Moving the Dwarf when he Walks

    // Add this to the UpdateState method
    KeyboardState keyState = Keyboard.GetState();
    BonePoseCollection poses = dwarfAnimator.BonePoses;
    if (state == "idle")
    {
        currentSpeed = 0;
        if (keyState.IsKeyDown(Keys.W))
            state = "walk";
        RunController(dwarfAnimator, idle);
    }
    else if (state == "walk")
    {
        currentSpeed = WALK_SPEED;
        if (keyState.IsKeyUp(Keys.W))
            state = "idle";
        RunController(dwarfAnimator, walk);
    }