Time for action – the GameOver screen
1. Add a new class file called
GameOverScreen.cs
to the Screens folder of theMars Runner
project.2. Add the following
using
directives at the beginning of theGameOverScreen
class file:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics;
3. Modify the
namespace
declaration for the class file by removing.Screens
from the end of the namespace. The namespace line should now read as follows:namespace Mars_Runner
4. Modify the declaration of the
GameOverScreen
class to inherit from theGameScreen
class. The new declaration line should read as follows:class GameOverScreen : GameScreen
5. Add fields to the
GameOverScreen
class as follows:#region Fields private float displayTimer = 8f; private float displayCounter = 0f; Texture2D blank; SpriteFont font; ContentManager content; #endregion
6. Override the
LoadContent()
method in theGameOverScreen
class as follows:#region Initialization public override void...