コード例 #1
0
ファイル: Tank.cs プロジェクト: Sub6Resources/Tank-Game
 //overloaded constructor(s)
 public Tank(Game1 _game, string _tankSpriteName, Vector2 _location, Vector2 _speed, float _rotation, int _player, float _scale, Texture2D _whiteRectangle, Keys _keyUp, Keys _keyLeft, Keys _keyDown, Keys _keyRight, Keys _keyBoost, Keys _keyReverse)
 {
     tankTexture      = _game.Content.Load <Texture2D>(_tankSpriteName);
     location         = _location;
     startingLocation = _location;
     speed            = _speed;
     rotation         = _rotation;
     origin           = new Vector2(this.tankTexture.Width / 2f, this.tankTexture.Height / 2f);
     game             = _game;
     player           = _player;
     scale            = _scale;
     whiteRectangle   = _whiteRectangle;
     keyUp            = _keyUp;
     keyLeft          = _keyLeft;
     keyDown          = _keyDown;
     keyRight         = _keyRight;
     keyBoost         = _keyBoost;
     keyReverse       = _keyReverse;
     alive            = true;
     lives            = 3;
     respawnParticles = new ParticleSpray(location, game, player, whiteRectangle, Color.Gray, 0);
     deathParticles   = new ParticleSpray(location, game, player, whiteRectangle, Color.Gray, 0);
     hitParticles     = new ParticleSpray(location, game, player, whiteRectangle, Color.Gray, 0);
     tankRect         = new Rectangle((int)location.X - (tankTexture.Width / 2), (int)location.Y - (tankTexture.Height / 2), tankTexture.Width, tankTexture.Height);
 }
コード例 #2
0
ファイル: Tank.cs プロジェクト: Sub6Resources/Tank-Game
 public virtual void Die()
 {
     if (alive)
     {
         deathParticles = new ParticleSpray(location, game, player, whiteRectangle, Color.Black, 2);
         alive          = false;
         location       = new Vector2(-100, -100);
     }
 }
コード例 #3
0
ファイル: Tank.cs プロジェクト: Sub6Resources/Tank-Game
 public void Respawn(Vector2 _location)
 {
     if (!alive)
     {
         location         = _location;
         lives            = 3;
         respawnParticles = new ParticleSpray(location, game, player, whiteRectangle, Color.Green, 2);
         alive            = true;
     }
 }
コード例 #4
0
ファイル: Tank.cs プロジェクト: Sub6Resources/Tank-Game
 public virtual void Hit()
 {
     lives -= 1;
     if (lives < 1)
     {
         Die();
     }
     else
     {
         hitParticles = new ParticleSpray(location, game, player, whiteRectangle, Color.Black, 2, 5);
     }
 }
コード例 #5
0
 public EnemyTank(Game1 _game, string _tankSpriteName, Vector2 _location, Vector2 _speed, float _rotation, int _player, float _scale, Texture2D _whiteRectangle)
 {
     tankTexture      = _game.Content.Load <Texture2D>(_tankSpriteName);
     location         = _location;
     startingLocation = _location;
     speed            = _speed;
     rotation         = _rotation;
     origin           = new Vector2(this.tankTexture.Width / 2f, this.tankTexture.Height / 2f);
     game             = _game;
     player           = _player;
     scale            = _scale;
     whiteRectangle   = _whiteRectangle;
     alive            = true;
     lives            = 3;
     respawnParticles = new ParticleSpray(location, game, player, whiteRectangle, Color.Gray, 0);
     deathParticles   = new ParticleSpray(location, game, player, whiteRectangle, Color.Gray, 0);
     tankRect         = new Rectangle((int)location.X - (tankTexture.Width / 2), (int)location.Y - (tankTexture.Height / 2), tankTexture.Width, tankTexture.Height);
     targetDirection  = DOWN;
 }