X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FProjectile.cs;h=a1d7f2779ccb7d8de22f23885d44817f4b2fdab8;hp=3f5b1368466a9496318ae47a3b63a86d315ff388;hb=198cb6056e93fecd69e65351ca8d0b34a077523f;hpb=b32b73746f5bf95771eb5f9db95763ce2a44049f diff --git a/CarFire/CarFire/CarFire/Projectile.cs b/CarFire/CarFire/CarFire/Projectile.cs index 3f5b136..a1d7f27 100644 --- a/CarFire/CarFire/CarFire/Projectile.cs +++ b/CarFire/CarFire/CarFire/Projectile.cs @@ -15,7 +15,6 @@ namespace CarFire public class Projectile { //Member Variables - Map theMap; Vector2 velocity; Texture2D projectileModel; int damage; @@ -27,6 +26,8 @@ namespace CarFire int pixelY; MovementManager mMotion; Point mPosition; + int mCharacterIndex; + Game mGame; /// /// The Constructor for a projectile object. @@ -38,17 +39,20 @@ namespace CarFire /// The starting Y position in the map grid /// The absolute X pixel position on the map /// The absolute Y pixel position on the map - public Projectile(Map _currentMap, + public Projectile(Game theGame, Texture2D _projectileModel, Vector2 _velocity, - Point _position) + Point _position, + int characterNumber, + int _damage) { - theMap = _currentMap; + mGame = theGame; + mCharacterIndex = characterNumber; projectileModel = _projectileModel; velocity = _velocity; mPosition = _position; - damage = 20; + damage = _damage; // Speed is the number of grid cells you can move through per second. mMotion = new MovementManager(mPosition, velocity.Length()); } @@ -66,7 +70,7 @@ namespace CarFire moveDown = true; else if (velocity.Y < 0) moveUp = true; - Point destination = MovementManager.GetNeighborCell(mMotion.Coordinates, moveLeft, moveRight, moveUp, moveDown); + Point destination = MovementManager.GetNeighbor(mMotion.Coordinates, moveLeft, moveRight, moveUp, moveDown); mMotion.Update(timeSpan, moveLeft, moveRight, moveUp, moveDown); @@ -79,7 +83,7 @@ namespace CarFire /// The map Y pixel position of the topLeft of the display public void Draw(SpriteBatch spriteBatch) { - Rectangle position = theMap.GetRectangleFromCoordinates(mMotion.Position); + Rectangle position = mGame.State.Map.GetRectangleFromCoordinates(mMotion.Position); spriteBatch.Draw(projectileModel, position, Color.White); } @@ -91,8 +95,8 @@ namespace CarFire public int GridY { get { return gridY; } set { gridY = value; } } public int PixelX { get { return pixelX; } set { pixelX = value; } } public int PixelY { get { return pixelY; } set { pixelY = value; } } - public Map TheMap { get { return theMap; } set { theMap = value; } } public int Damage { get { return damage; } set { damage = value; } } + public int CharacterIndex { get { return mCharacterIndex; } } public Vector2 Position { get { return mMotion.Position; } } public Point Coordinates { get { return mMotion.Coordinates; } } }