diff options
-rw-r--r-- | src/view/MapView.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/view/MapView.ts b/src/view/MapView.ts index 5c30f20..f6736e2 100644 --- a/src/view/MapView.ts +++ b/src/view/MapView.ts @@ -20,7 +20,8 @@ export default class MapView { for (let x = 0; x < map.data.width; x++) for (let y = 0; y < map.data.height; y++) - this.addTile(vertexData, textureData, x, y, map.data.layers[0][y][x]); + for (const layer of map.data.layers) + this.addTile(vertexData, textureData, x, y, layer[y][x]); const gl = r.getContext(); @@ -64,6 +65,9 @@ export default class MapView { } private addTile(vertexData: number[], textureData: number[], x: number, y: number, tile: string) { + if (tile === ' ') + return; + const tilePos = this.tileMap.tiles.get(tile); if (!tilePos) throw new Error('invalid tile specifier in map data'); |