public static boolean[][] generate(Room r){ boolean[][] maze = new boolean[r.width()][r.height()]; for (int x = 0; x < maze.length; x++) { for (int y = 0; y < maze[0].length; y++) { if (x == 0 || x == maze.length - 1 || y == 0 || y == maze[0].length - 1) { maze[x][y] = FILLED; } } } //set spaces where there are doors for (Room.Door d : r.connected.values()) { maze[d.x - r.left][d.y - r.top] = EMPTY; } return generate(maze); }
public static boolean[][] generate(Room r){ boolean[][] maze = new boolean[r.width()][r.height()]; for (int x = 0; x < maze.length; x++) { for (int y = 0; y < maze[0].length; y++) { if (x == 0 || x == maze.length - 1 || y == 0 || y == maze[0].length - 1) { maze[x][y] = FILLED; } } } //set spaces where there are doors for (Room.Door d : r.connected.values()) { maze[d.x - r.left][d.y - r.top] = EMPTY; } return generate(maze); }
targetCenter.y = prev.top - (next.height() - 1) / 2f; targetCenter.x = (float) ((targetCenter.y - b) / m); next.setPos(Math.round(targetCenter.x - (next.width() - 1) / 2f), prev.top - (next.height() - 1)); next.setPos(Math.round(targetCenter.x - (next.width() - 1) / 2f), prev.bottom); targetCenter.x = prev.right + (next.width()-1)/2f; targetCenter.y = (float)(m*targetCenter.x + b); next.setPos( prev.right, Math.round(targetCenter.y - (next.height()-1)/2f)); targetCenter.x = prev.left - (next.width()-1)/2f; targetCenter.y = (float)(m*targetCenter.x + b); next.setPos( prev.left - (next.width() - 1), Math.round(targetCenter.y - (next.height()-1)/2f));
targetCenter.y = prev.top - (next.height() - 1) / 2f; targetCenter.x = (float) ((targetCenter.y - b) / m); next.setPos(Math.round(targetCenter.x - (next.width() - 1) / 2f), prev.top - (next.height() - 1)); next.setPos(Math.round(targetCenter.x - (next.width() - 1) / 2f), prev.bottom); targetCenter.x = prev.right + (next.width()-1)/2f; targetCenter.y = (float)(m*targetCenter.x + b); next.setPos( prev.right, Math.round(targetCenter.y - (next.height()-1)/2f)); targetCenter.x = prev.left - (next.width()-1)/2f; targetCenter.y = (float)(m*targetCenter.x + b); next.setPos( prev.left - (next.width() - 1), Math.round(targetCenter.y - (next.height()-1)/2f));
if (room.width() <= 4 || room.height() <= 4) { continue;
if (room.width() <= 4 || room.height() <= 4) { continue;