Time for action – tracking the flood
Add the following declarations to the
Game1
class:Private Const MaxFloodCounter As Single = 100.0 Private floodCount As Single = 0.0 Private timeSinceLastFloodIncrease As Single = 0.0 Private timeBetweenFloodIncreases As Single = 1.0 Private floodIncreaseAmount As Single = 0.5
In the
Update()
method ofGame1.vb
, add the following code to keep track of the increasing flood waters, right after thetimeSinceLastInput
variable is updated in theGameState.Playing
case section:timeSinceLastFloodIncrease += CSng(gameTime.ElapsedGameTime.TotalSeconds) If timeSinceLastFloodIncrease >= timeBetweenFloodIncreases Then floodCount += floodIncreaseAmount timeSinceLastFloodIncrease = 0.0 If (floodCount >= MaxFloodCounter) Then gameOverTimer = 8.0 gameState = GameStates.GameOver End If End If
Update the
CheckScoringChain()
method of theGame1
class by adding the following to decrease the flood counter when the player scores. Place...