Time for action – letting the player play
Modify the
Update()
method ofGame1.vb
, by adding the following before the call toMyBase.Update(gameTime)
:Select Case gameState Case GameStates.TitleScreen If Keyboard.GetState().IsKeyDown(Keys.Space) Then _gameBoard.ClearBoard() _gameBoard.GenerateNewPieces(False) playerScore = 0 gameState = GameStates.Playing End If Case GameStates.Playing timeSinceLastInput += (CSng(gameTime.ElapsedGameTime.TotalSeconds)) If timeSinceLastInput >= MinTimeSinceLastInput Then HandleMouseInput(Mouse.GetState()) End If _gameBoard.ResetWater() Dim y As Integer For y = 0 To GameBoard.GameBoardHeight CheckScoringChain(_gameBoard.GetWaterChain(y)) Next _gameBoard.GenerateNewPieces(True) End Select
What just happened?
The Update()
method performs two different functions, depending on the current gameState
value. If the game is in TitleScreen
state, Update...