Exemplo n.º 1
0
 public int fireDown() throws Exception {
   String str = getQuadrantXY(tank.getX(), tank.getY());
   int tankV = Integer.valueOf(str.substring(0, 1));
   int tankH = Integer.valueOf(str.substring(2, str.length()));
   tank.turn(Direction.DOWN);
   for (int idx = tankV; idx < battleField.getBattleField().length; idx++) {
     for (int j = tankH; j < tankH + 1; j++) {
       if (battleField.scanQuadrant(idx, j) == "B") {
         tank.fire();
       }
     }
   }
   return tankV;
 }
Exemplo n.º 2
0
 private boolean processInterception() {
   String str = getQuadrantXY(bullet.getX(), bullet.getY());
   int i = Integer.valueOf(str.substring(0, 1));
   int q = Integer.valueOf(str.substring(2, str.length()));
   if (i >= battleField.getBattleField().length - battleField.getBattleField().length
       && i < battleField.getBattleField().length
       && q >= battleField.getBattleField().length - battleField.getBattleField().length
       && q < battleField.getBattleField().length
       && battleField.scanQuadrant(i, q) == "B") {
     battleField.updateQuadrant(i, q, " ");
     return true;
   } else return false;
 }