This is frustrating me a lot.
“Dereferencing null/undefined value.”
let walls: boolean[][]
for (let x = -1; x < 31; x++) {
for (let y = -1; y < 31; y++) {
walls[x][y] = tiles.tileAtLocationIsWall(tiles.getTileLocation(x, y))
}
}
This is frustrating me a lot.
“Dereferencing null/undefined value.”
let walls: boolean[][]
for (let x = -1; x < 31; x++) {
for (let y = -1; y < 31; y++) {
walls[x][y] = tiles.tileAtLocationIsWall(tiles.getTileLocation(x, y))
}
}
You’re never assigning anythings to walls
. Try this:
let walls: boolean[][] = [];
for (let x = 0; x < 31; x++) {
walls[x] = [];
for (let y = 0; y < 31; y++) {
walls[x][y] = tiles.tileAtLocationIsWall(tiles.getTileLocation(x, y))
}
}
Lightning quick response! Thanks alot!!