X hits on this document

245 views

0 shares

0 downloads

0 comments

32 / 102

Task 1 – Basic game rendering

The focus of this task will be to add most drawing logic to the game in order to present the gameplay screen. We will also delve into gameplay logic where necessary and implement very basic versions of some of the game classes.

66.

We will start by creating the gameplay screen class and making it visible. Add a new class to the “Screens” folder and name it GameplayScreen.

67.

Add the following using statements to the beginning of the new class file:

C#

using Microsoft.Xna.Framework;

using Microsoft.Xna.Framework.Graphics;

using Microsoft.Xna.Framework.Audio;

using System.IO.IsolatedStorage;

using System.IO;

using Microsoft.Xna.Framework.Input;

using Microsoft.Xna.Framework.Input.Touch;

using GameStateManagement;

68.

Change the GameplayScreen class so that it will inherit from the GameScreen class:

C#

class GameplayScreen : GameScreen

{

}

69.

Add the following field definitions to the class. We will use these fields for loading the textures/fonts used to draw the screen (though some will not be used until much later in the exercise) and also to position some of the assets on the screen:

C#

// Texture Members

Texture2D foregroundTexture;

Texture2D cloud1Texture;

Texture2D cloud2Texture;

Texture2D mountainTexture;

Texture2D skyTexture;

Texture2D hudBackgroundTexture;

Texture2D ammoTypeTexture;

Texture2D windArrowTexture;

Texture2D defeatTexture;

Texture2D victoryTexture;

SpriteFont hudFont;

// Rendering members

Vector2 cloud1Position;

Vector2 cloud2Position;

70.

Override the LoadContent method in order to load the gamplay screen’s resources:

C#

Page | 32

Document info
Document views245
Page views245
Page last viewedTue Dec 06 13:24:02 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments