Example #1
0
        public Particle(Enemy enemy, Projectile projectile)
        {
            SourceRectangle = new Rectangle(0, 0, 32, 32);
            CurrentParticle = ParticleType.Impact;
            Texture = ContentHelper.LoadTexture("Explosion");

            if (projectile.GetVelocity().X > 0)
                CollRectangle = new Rectangle(enemy.GetCollRectangle().X - enemy.GetCollRectangle().Width / 2, projectile.GetCollRectangle().Center.Y - SourceRectangle.Height / 2, 32, 32);
            else CollRectangle = new Rectangle(enemy.GetCollRectangle().X + enemy.GetCollRectangle().Width / 2, projectile.GetCollRectangle().Center.Y - SourceRectangle.Height / 2, 32, 32);
            _frameCount = new Vector2(Texture.Width / 32, Texture.Height / 32);
        }
Example #2
0
 public Particle(Projectile proj)
 {
     CurrentParticle = ParticleType.SnakeVenom;
     Texture = ContentHelper.LoadTexture("Effects/venom_blob");
     _randGen = new Random();
     CollRectangle = new Rectangle(proj.GetCollRectangle().X + proj.GetCollRectangle().Width / 2, proj.GetCollRectangle().Y, 8, 8);
     if (proj.GetVelocity().X > 0)
         Velocity.X = -2;
     else Velocity.X = 2;
     Velocity.Y = GameWorld.RandGen.Next(1, 4);
     if (GameWorld.RandGen.Next(0, 2) == 0)
         Velocity.Y = -Velocity.Y;
     SourceRectangle = new Rectangle(0, 0, Texture.Width, Texture.Height);
     Opacity = 1f;
 }
Example #3
0
 public Particle(Projectile projectile, Tile[] tileArray)
 {
     SourceRectangle = new Rectangle(0, 0, 32, 32);
     CurrentParticle = ParticleType.Impact;
     Texture = ContentHelper.LoadTexture("Explosion");
     if (projectile.GetVelocity().X > 0)
         CollRectangle = new Rectangle(tileArray[projectile.TileHit].DrawRectangle.X - 32, projectile.GetCollRectangle().Center.Y - 32, 64, 64);
     else CollRectangle = new Rectangle(tileArray[projectile.TileHit].DrawRectangle.X + 32, projectile.GetCollRectangle().Center.Y - 32, 64, 64);
     _frameCount = new Vector2(Texture.Width / 32, Texture.Height / 32);
 }