Пример #1
0
 public static void FireMissile(int angle, int power, Player player, Player defender)
 {
     double Vx = ConvertPowerToX(angle, power);
     double Vy = ConvertPowerToY(angle, power);
     for (double i = 0; i < 10; i += 0.05)
     {
         if (!checkForCollision(defender.tank, player.missile) && !checkForEnvironmentCollision(player.missile))
         {
             player.missile.Location = new Point(Convert.ToInt32(player.missile.Location.X + (Vx * i)), Convert.ToInt32(player.missile.Location.Y - ((Vy * i) - ((GRAVITY/2) * (i * i)))));
             //BFT TODO: Get rid of this
             Thread.Sleep(20);
         }
     }
     //Explosion(player.missile);
     if (checkForCollision(defender.tank, player.missile))
     {
         player.AddPoint();
     }
     player.missile.Location = new Point(player.tank.Left + ((player.tank.Right - player.tank.Left) / 4), player.tank.Top + ((player.tank.Bottom - player.tank.Top) / 4));
 }