Time for action – game over
Modify the declaration of the
GameStates
Enum
in theGame1
class to include theGameOver
state as follows:Private Enum GameStates TitleScreen Playing GameOver End Enum
Add the following declarations to the
Game1
class:Private gameOverLocation as Vector2 = new Vector2(200, 260) Private gameOverTimer as Single
Modify the
Update()
method ofGame1
by adding a new case section for theGameState.GameOver
state:Case GameStates.GameOver gameOverTimer -= CSng(gameTime.ElapsedGameTime.TotalSeconds) If gameOverTimer <= 0 Then gameState = GameStates.TitleScreen End If
Modify the
if
statement in theDraw()
method ofGame1
for theGameState.Playing
state fromif (gameState = GameStates.Playing) Then
to the following:If (gameState = GameStates.Playing) Or (gameState = GameStates.GameOver) Then
Add a new
if
statement for theGameState.GameOver
state to theDraw()
method, right before the call toMyBase.Draw(gameTime)
:If (gameState = GameStates...