X hits on this document

270 views

0 shares

0 downloads

0 comments

51 / 102

}

Vector2 projectilePosition = Vector2.Zero;

public Vector2 ProjectilePosition

{

   get

   {

       return projectilePosition;

   }

   set

   {

       projectilePosition = value;

   }

}

// Gets the position where the projectile hit the ground.

// Only valid after a hit occurs.

public Vector2 ProjectileHitPosition { get; private set; }

Texture2D projectileTexture;

public Texture2D ProjectileTexture

{

   get

   {

       return projectileTexture;

   }

   set

   {

       projectileTexture = value;

   }

}

Most of the above fields and properties have names that make it possible to deduce their purposes, but this will become clearer as we implement more of the projectile’s code.

121.

Add the following constructors to the Projectile class:

C#

public Projectile(Game game)

   : base(game)

{

   curGame = game;

   random = new Random();

}

public Projectile(Game game, SpriteBatch screenSpriteBatch,

string TextureName, Vector2 startPosition, float groundHitOffset,

   bool isAi, float Gravity)

   : this(game)

Page | 51

Document info
Document views270
Page views270
Page last viewedThu Dec 08 08:17:29 UTC 2016
Pages102
Paragraphs3115
Words17333

Comments