X hits on this document

282 views

0 shares

0 downloads

0 comments

38 / 102

   : base(game)

{

}

public AI(Game game, SpriteBatch screenSpriteBatch)

   : base(game, screenSpriteBatch)

{

   // TODO: Initialize catapult

}

Now that our basic versions of the player classes are ready, it is time to utilize them in GameplayScreen.

89.

Open the file GameplayScreen.cs located inside the Screens project folder and add additional variable definitions to the GameplayScreen class. Place them just under the existing variable definitions (old code has been colored gray):

C#

...

Vector2 cloud1Position;

Vector2 cloud2Position;

Vector2 playerHUDPosition;

Vector2 computerHUDPosition;

Vector2 windArrowPosition;

// Gameplay members

Human player;

AI computer;

Vector2 wind;

bool changeTurn;

bool isHumanTurn;

bool gameOver;

Random random;

const int minWind = 0;

const int maxWind = 10;

// Helper members

bool isDragging;

Most of these new variables are not immediately useful. They will come into play as we add more game logic.

90.

Revise the GameplayScreen class’s LoadContent method by adding additional initialization at its end:

C#

   ...

   hudFont = Load<SpriteFont>("Fonts/HUDFont");

   // Define initial cloud position

Page | 38

Document info
Document views282
Page views282
Page last viewedFri Dec 09 10:21:22 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments