Fix HTML and map loop

This commit is contained in:
Nikita Iryupin 2021-06-05 22:22:22 +02:00
parent ac87e817b8
commit 9a822a1833
3 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="ru">
<head lang='en'>
<meta charset='utf-8'>
@ -24,7 +24,7 @@
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="213.7px"
x="0px" y="0px" width="213.7px"
height="213.7px" viewBox="0 0 213.7 213.7" enable-background="new 0 0 213.7 213.7"
xml:space="preserve">

View File

@ -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) {

View File

@ -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();