Time for action – updating Game1 to update animated pieces

  1. Modify the Update() method of the Game1 class by replacing the current case statement for the GameState.Playing state with:
    case GameStates.Playing:
        timeSinceLastInput +=
            (float)gameTime.ElapsedGameTime.TotalSeconds;
    
        if (gameBoard.ArePiecesAnimating())
        {
            gameBoard.UpdateAnimatedPieces();
        }
        else
        {
            gameBoard.ResetWater();
    
            for (int y = 0; y < GameBoard.GameBoardHeight; y++)
            {
                CheckScoringChain(gameBoard.GetWaterChain(y));
            }
    
            gameBoard.GenerateNewPieces(true);
    
            if (timeSinceLastInput >= MinTimeSinceLastInput)
            {
                HandleMouseInput(Mouse.GetState());
            }
        }
    
        break;

What just happened?

This method is very similar to its previous incarnation. In this instance, we check to see if there are outstanding animated ...

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.