Exemple #1
0
        public void Hit(Projectile proj)
        {
            if (!proj.shoot)
            {
                return;
            }

            int xc = proj.x - x - 5;
            int xi = xc / 6;

            int yc = proj.y - y - 1;

            if (xi < 0 || xi > 10 || yc < 0)
            {
                return;
            }

            int id = Active[xi];

            if (id < 0)
            {
                return;
            }

            if (yc > id * 5 && yc < id * 5 + 5)
            {
                ALIVE[xi + (4 - Active[xi]) * 11] = false;
                Active[xi]--;

                proj.Stop();

                CalculateBounds();
            }
        }
Exemple #2
0
        public bool Hit(Projectile p)
        {
            int index = InsideBounds(p.x, p.y, p.delta);

            if (index < 0)
            {
                return(false);
            }

            Walls[index]--;
            if (index % 10 > 0)
            {
                Walls[index - 1]--;
            }
            if (index % 10 < 9)
            {
                Walls[index + 1]--;
            }
            if (index / CL > 0)
            {
                Walls[index - CL]--;
            }
            if (index / CL < H - 1)
            {
                Walls[index + CL]--;
            }

            p.Stop();
            return(true);
        }
Exemple #3
0
 public void Hit(Projectile proj)
 {
     if (!proj.shoot)
     {
         return;
     }
     if (proj.x - 4 > x && proj.x - 5 < x + 7)
     {
         if (proj.y > 69)                  // HIT
         {
             hp--;
             proj.Stop();
         }
     }
 }