Time for action – modify Game1 to generate rotating pieces

  1. Update the HandleMouseInput() method in the Game1 class to add rotating pieces to the board by adding the following inside the if (mouseState.LeftButton == ButtonState.Pressed) block before gameBoard.RotatePiece() is called:
    gameBoard.AddRotatingPiece(x, y,
        gameBoard.GetSquare(x, y), false);
  2. Still in HandleMouseInput(), add the following in the same location inside the if block for the right mouse button:
    gameBoard.AddRotatingPiece(x, y,
        gameBoard.GetSquare(x, y), true);

What just happened?

Recall that the only difference between a clockwise rotation and a counter-clockwise rotation (from the standpoint of the AddRotatingPiece() method) is a true or false in the final parameter. Depending ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.