Time for action – Game1 declarations

  1. Double click on the Game1.cs file in Solution Explorer to reactivate the Game1.cs code file window.
  2. Add the following declarations to the Game1 class member declaration area:
    GameBoard gameBoard;
    
    Vector2 gameBoardDisplayOrigin = new Vector2(70, 89);
    
    int playerScore = 0;
    
    enum GameStates { TitleScreen, Playing };
    GameStates gameState = GameStates.TitleScreen;
    
    Rectangle EmptyPiece = new Rectangle(1, 247, 40, 40);
    
    const float MinTimeSinceLastInput = 0.25f;
    float timeSinceLastInput = 0.0f;

What just happened?

The gameBoard instance of GameBoard will hold all of the playing pieces, while the gameBoardDisplayOrigin vector points to where on the screen the board will be drawn. Using a vector like this makes it easy to ...

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.