X hits on this document

264 views

0 shares

0 downloads

0 comments

34 / 102

   // Clear the background

   ScreenManager.Game.GraphicsDevice.Clear(Color.White);

   // Draw the Sky

   ScreenManager.SpriteBatch.Draw(skyTexture, Vector2.Zero, Color.White);

   // Draw Cloud #1

   ScreenManager.SpriteBatch.Draw(cloud1Texture,

       cloud1Position, Color.White);

   // Draw the Mountain

   ScreenManager.SpriteBatch.Draw(mountainTexture,

       Vector2.Zero, Color.White);

   // Draw Cloud #2

   ScreenManager.SpriteBatch.Draw(cloud2Texture,

       cloud2Position, Color.White);

   // Draw the Castle, trees, and foreground

   ScreenManager.SpriteBatch.Draw(foregroundTexture,

       Vector2.Zero, Color.White);

}

It is now possible for a user to see the gameplay screen, but we must first  connect it to the rest of the game. In order to accomplish that, we will revisit some of our code from exercise 1.

73.

Open the InstructionsScreen.cs file under the Screens project folder, navigate to the HandleInput method and alter it to look like this:

C#

public override void HandleInput(InputState input)

{

   foreach (var gesture in input.Gestures)

   {

       if (gesture.GestureType == GestureType.Tap)

       {

           ExitScreen();

           ScreenManager.AddScreen(new GameplayScreen(), null);

       }

   }

   base.HandleInput(input);

}

74.

Build the project and deploy it. You will now be able to select the “Play” menu entry and advance past the instructions screen. You should see the following screen in result:

Page | 34

Document info
Document views264
Page views264
Page last viewedThu Dec 08 00:13:02 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments