X hits on this document

371 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 views371
Page views371
Page last viewedSat Jan 21 18:21:48 UTC 2017
Pages102
Paragraphs3115
Words17333

Comments