public class PathGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
height
The height of the path matrix.
|
private int[][] |
pathMatrix
The 2D array, to save path states.
|
private int |
width
The width of the path matrix.
|
Constructor and Description |
---|
PathGenerator(int width,
int height)
Creates a new path generator with given sizes.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
coll(int x,
int y) |
int[][] |
getPathMatrix() |
private boolean |
isValidCell(int x,
int y,
boolean checkNeighbours)
Checks if a cell can be made into a path.
|
void |
run()
Lets the generator run, to generate the room matrix.
|
void |
run(int pathStart)
Lets the generator run, to generate the room matrix.
|
private int width
private int height
private int[][] pathMatrix
public PathGenerator(int width, int height)
width
- The width of the path matrix.height
- The height of the path matrix.public void run()
public void run(int pathStart)
pathStart
- The horizontal cell where the path should start.private boolean isValidCell(int x, int y, boolean checkNeighbours)
x
- The x coordinate of the cell.y
- The y coordinate of the cell.checkNeighbours
- If it should be checked, that the cell doesn't collide with neighbours.private boolean coll(int x, int y)
public int[][] getPathMatrix()