better walls
This commit is contained in:
parent
217685055e
commit
50d25f3103
|
@ -93,10 +93,14 @@ const getIndex = (row, column) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const is_inner_wall = (tiles, col, row) => {
|
const is_inner_wall = (tiles, col, row) => {
|
||||||
if (col > 0 && tiles[getIndex(row, col-1)] == Cell.Floor) {return false}
|
|
||||||
if (row > 0 && tiles[getIndex(row-1, col)] == Cell.Floor) {return false}
|
for (let c = Math.max(col-1, 0); c < Math.min(col+2, width); c++) {
|
||||||
if (col < width-1 && tiles[getIndex(row, col+1)] == Cell.Floor) {return false}
|
for (let r = Math.max(row-1, 0); r < Math.min(row+2, height); r++) {
|
||||||
if (row < height-1 && tiles[getIndex(row+1, col)] == Cell.Floor) {return false}
|
if ((c != col || r != row) && tiles[getIndex(r, c)] == Cell.Floor) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user