diff --git a/assets/maps/microban.js b/assets/maps/microban.js index 7bcc832..e5bb084 100644 --- a/assets/maps/microban.js +++ b/assets/maps/microban.js @@ -22,7 +22,7 @@ var level_2 = ` var level_3_par = 100; var level_3 = ` - #### +###### ### #### # 0 # # # #0 # @@ -58,7 +58,7 @@ var level_6 = ` # 00 #@# # 0 #... # # ######## -##### +############ `; var level_7_par = 100; diff --git a/assets/script.js b/assets/script.js index 94b5359..cb22ec1 100644 --- a/assets/script.js +++ b/assets/script.js @@ -1,7 +1,7 @@ class Game { constructor() { this.mapInstance = null; - this.level = 0; + this.level = 1; this.lives = 10; this.points = 0; this.totalMoves = 0; @@ -99,10 +99,15 @@ class Map { } display() { + let grillChar = false; for (let i = 0; i < this.storageLocations.length; i++) { if (this.mapArray[this.storageLocations[i][0]][this.storageLocations[i][1]] === ' ') { this.mapArray[this.storageLocations[i][0]][this.storageLocations[i][1]] = '.'; } + + if (this.mapArray[this.storageLocations[i][0]][this.storageLocations[i][1]] === '@') { + grillChar = true; + } } let map = ""; @@ -117,7 +122,11 @@ class Map { } else if (this.mapArray[i][j] === "*") { map += ''; } else if (this.mapArray[i][j] === "@") { - map += ``; + if (!grillChar) { + map += ``; + } else { + map += ``; + } } else if (this.mapArray[i][j] === ".") { map += ''; } @@ -128,6 +137,9 @@ class Map { let mapDiv = document.getElementById("map"); mapDiv.innerHTML = ''; mapDiv.innerHTML = map; + + let statsDiv = document.getElementById("stats"); + statsDiv.innerHTML = `LEVEL: ${this.level} | MOVES: ${g.levelMoves[this.level]} | LIVES: ${g.lives} | POINTS: ${g.points}` } move(direction) { diff --git a/index.html b/index.html index 39ea928..db8530d 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,5 @@ + @@ -11,6 +12,12 @@ background-color: #efd4af; } + .container { + display: flex; + justify-content: center; + width: 100%; + } + #map { white-space: pre; } @@ -19,11 +26,33 @@ height: 50px; width: 50px; } + + #stats { + font-size: 20px; + margin-bottom: 8px; + } + + pre { + color: darkblue; + margin-bottom: -19px; + }
-
+
+█▀ █▀█ █▄▀ █▀█ █▄▄ ▄▀█ █▄░█ █▄█ ▄▀█
+▄█ █▄█ █░█ █▄█ █▄█ █▀█ █░▀█ ░█░ █▀█
+      
+
+ LEVEL: 0 | + MOVES: 0 | + LIVES: 10 | + POINTS: 0 +
+
+
+