diff --git a/public/index.html b/public/index.html index df98006..aa05c8e 100644 --- a/public/index.html +++ b/public/index.html @@ -1,5 +1,5 @@ - + @@ -24,7 +24,7 @@ diff --git a/src/GameLogic/gameField.js b/src/GameLogic/gameField.js index 1912096..bb2bf6a 100644 --- a/src/GameLogic/gameField.js +++ b/src/GameLogic/gameField.js @@ -87,7 +87,7 @@ export class GameField { this.canvas.height = this.height; this.canvas.width = this.width; this.collisionManager.attachMap(this.map); - this.aiTanks.setCount(this.map._enemiesCount); + this.aiTanks.setCount(this.map == null ? null : this.map._enemiesCount); } async play(level, firstTime) { diff --git a/src/Graphics/Map/mapParser.js b/src/Graphics/Map/mapParser.js index f8d54d8..88a4af0 100644 --- a/src/Graphics/Map/mapParser.js +++ b/src/Graphics/Map/mapParser.js @@ -13,8 +13,8 @@ export class MapParser { async getMap(levelNumber, tileset) { let json = this.levelStorage.getLevel(levelNumber); - if (!json) { - let fetchResult = await fetch(`./stages/stage-${levelNumber}.json`); + if (json == null) { + let fetchResult = await fetch(`./stages/stage-${levelNumber}.json`).catch(console.log("Map not found!")); if (!fetchResult.ok) return null; json = await fetchResult.text();