Time for action – Game1 declarations
Double click on the
Game1.vb
file in Solution Explorer to reactivate theGame1.vb
code file window.Add the following declarations to the
Game1
class member declaration area:Private _gameBoard As GameBoard Private gameBoardDisplayOrigin As New Vector2(70, 89) Private playerScore As Integer = 0 Private Enum GameStates TitleScreen Playing End Enum Private gameState As GameStates = GameStates.TitleScreen Private EmptyPiece As Rectangle = New Rectangle(1, 247, 40, 40) Private Const MinTimeSinceLastInput As Single = 0.25 Private timeSinceLastInput As Single = 0
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 move the board in the event that you wish to change the layout of our game screen.
As we did in SquareChase
, we store the player's score and will display it in the window...