if (width > minTilesWidth && width % 2 == 0) {
int newWidth = width / 2;
for (int i = 0; i < 4; i++) {
int x = i / 2;
int y = i % 2;
BoundingBox bounds = new BoundingBox(
parentMinX + (newWidth * World.TILE_WIDTH) / 2 + (newWidth * World.TILE_WIDTH) / 2 * (x - y),
parentMinY + (newWidth * World.TILE_HEIGHT) / 2 * (x + y),
newWidth * World.TILE_WIDTH,
newWidth * World.TILE_HEIGHT);
if (bounds.intersects(checkBounds)) {
renderLevel(bounds.getMinX(), bounds.getMinY(),
parentOffsetX + x * newWidth, parentOffsetY + y * newWidth,
newWidth);
}
}
} else {
int to = (int) Math.pow(width, 2);
for (int i = 0; i < to; i++) {
int x = i / width;
int y = i % width;
BoundingBox bounds = new BoundingBox(
parentMinX + (width * World.TILE_WIDTH) / 2 + World.TILE_WIDTH / 2 * (x - y),
parentMinY + World.TILE_HEIGHT / 2 * (x + y),
World.TILE_WIDTH, World.TILE_HEIGHT);
Point2D point = new Point2D(bounds.getMinX(), bounds.getMinY());
if (bounds.intersects(checkBounds)) {
if (!visibleNodes.containsKey(point)) {
Tile tile = world.getTile(parentOffsetX + x, parentOffsetY + y);
Node node = resourceLoader.createResource(tile);
if (node != null) {
node.setLayoutX(point.getX());