application.windows32/source/BattleCity_Tank.java
/*
  Checks whether any tanks are occupying that position
 x, y are center coordinates
 */
Checks whether any tanks are occupying that position
x, y are center coordinates
Checks whether any tanks are occupying that position x y are center coordinates
public boolean noTanksOn(int x, int y) {
  for (Enemy enemy : enemyTanks) {
    if (squaresOverlap(x - Tank.SIZE/2, y - Tank.SIZE/2, Tank.SIZE, enemy.x - Enemy.SIZE/2, enemy.y - Enemy.SIZE/2, Enemy.SIZE)) {
      return false;
    }
  }
  if (squaresOverlap(x - Tank.SIZE/2, y - Tank.SIZE/2, Tank.SIZE, player1Tank.x - Player.SIZE/2, player1Tank.y - Player.SIZE/2, Player.SIZE)) {
    return false;
  }
  return true;
}
public boolean noTanksOn ( int x , int y ) { for ( Enemy enemy : enemyTanks ) { if ( squaresOverlap ( x - Tank . SIZE / 2 , y - Tank . SIZE / 2 , Tank . SIZE , enemy . x - Enemy . SIZE / 2 , enemy . y - Enemy . SIZE / 2 , Enemy . SIZE ) ) { return false ; } } if ( squaresOverlap ( x - Tank . SIZE / 2 , y - Tank . SIZE / 2 , Tank . SIZE , player1Tank . x - Player . SIZE / 2 , player1Tank . y - Player . SIZE / 2 , Player . SIZE ) ) { return false ; } return true ; }
Checks whether any tanks are occupying that position
x, y are center coordinates
Checks whether any tanks are occupying that position x y are center coordinates