checkMap method

bool checkMap(
  1. double x,
  2. double y,
  3. double w,
  4. double h,
)

Implementation

bool checkMap(double x, double y, double w, double h) {
  if (mapX - x < w) {
    return false;
  }
  if (mapY - y < h) {
    return false;
  }
  for (int i = x.toInt(); i < x.toInt() + w; i++) {
    for (int j = y.toInt(); j < y.toInt() + h; j++) {
      if (map[i][j] == 1) {
        return false;
      }
    }
  }
  return true;
}