/** * Calculates whether certain Location is suitable for spawning a new Building (out of bounds, * overlapping) * * @param loc Location that should be checked * @return Boolean indicating elgibility to spawn new Building * @see Building */ public Boolean checkPositionElgibility(Location loc) { for (Building b : WorldManager.getInstance().getBuildings()) { if (loc.X() >= b.getPosition().X() - SimulationConfig.getBuildingSpriteWidth() && loc.X() <= b.getPosition().X() + SimulationConfig.getBuildingSpriteWidth() && loc.Y() >= b.getPosition().Y() - SimulationConfig.getBuildingSpriteHeight() && loc.Y() <= b.getPosition().Y() + SimulationConfig.getBuildingSpriteHeight()) return false; } return true; }