Пример #1
0
 public boolean isDiagonalNeighbor(Tile o) {
   boolean isDiagonal = false;
   if (getLocation().x - 1 == o.getLocation().x && getLocation().y - 1 == o.getLocation().y) {
     isDiagonal = true;
   } else if (getLocation().x + 1 == o.getLocation().x
       && getLocation().y - 1 == o.getLocation().y) {
     isDiagonal = true;
   } else if (getLocation().x + 1 == o.getLocation().x
       && getLocation().y + 1 == o.getLocation().y) {
     isDiagonal = true;
   } else if (getLocation().x - 1 == o.getLocation().x
       && getLocation().y + 1 == o.getLocation().y) {
     isDiagonal = true;
   }
   return isDiagonal;
 }