traditional
This commit is contained in:
parent
50fa9b0f5c
commit
1d17a10e09
2 changed files with 31 additions and 17 deletions
|
@ -50,6 +50,7 @@ class Map {
|
||||||
|
|
||||||
this.totalWin = g.level + 1 == levels.length;
|
this.totalWin = g.level + 1 == levels.length;
|
||||||
this.finalPointsGiven = false;
|
this.finalPointsGiven = false;
|
||||||
|
this.traditional = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
generateMapArray() {
|
generateMapArray() {
|
||||||
|
@ -85,7 +86,11 @@ class Map {
|
||||||
getKeystroke() {
|
getKeystroke() {
|
||||||
var self = this;
|
var self = this;
|
||||||
_listener = function (event) {
|
_listener = function (event) {
|
||||||
if (["Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].indexOf(event.code) > -1) {
|
if (
|
||||||
|
["Space", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].indexOf(
|
||||||
|
event.code,
|
||||||
|
) > -1
|
||||||
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
var dontLoop = false;
|
var dontLoop = false;
|
||||||
|
@ -155,22 +160,26 @@ class Map {
|
||||||
let map = "";
|
let map = "";
|
||||||
for (let i = 0; i < this.mapArray.length; i++) {
|
for (let i = 0; i < this.mapArray.length; i++) {
|
||||||
for (let j = 0; j < this.mapArray[i].length; j++) {
|
for (let j = 0; j < this.mapArray[i].length; j++) {
|
||||||
if (this.mapArray[i][j] === "#") {
|
if (this.traditional) {
|
||||||
map += '<img src="assets/img/sprites/wall.png">';
|
map += this.mapArray[i][j];
|
||||||
} else if (this.mapArray[i][j] === " ") {
|
} else {
|
||||||
map += '<img src="assets/img/sprites/floor.png">';
|
if (this.mapArray[i][j] === "#") {
|
||||||
} else if (this.mapArray[i][j] === "0") {
|
map += '<img src="assets/img/sprites/wall.png">';
|
||||||
map += '<img src="assets/img/sprites/coal.png">';
|
} else if (this.mapArray[i][j] === " ") {
|
||||||
} else if (this.mapArray[i][j] === "*") {
|
map += '<img src="assets/img/sprites/floor.png">';
|
||||||
map += '<img src="assets/img/sprites/fire_coal.png">';
|
} else if (this.mapArray[i][j] === "0") {
|
||||||
} else if (this.mapArray[i][j] === "@") {
|
map += '<img src="assets/img/sprites/coal.png">';
|
||||||
if (!grillChar) {
|
} else if (this.mapArray[i][j] === "*") {
|
||||||
map += `<img src="assets/img/sprites/char${this.playerDir}.png">`;
|
map += '<img src="assets/img/sprites/fire_coal.png">';
|
||||||
} else {
|
} else if (this.mapArray[i][j] === "@") {
|
||||||
map += `<img src="assets/img/sprites/grill-char${this.playerDir}.png">`;
|
if (!grillChar) {
|
||||||
|
map += `<img src="assets/img/sprites/char${this.playerDir}.png">`;
|
||||||
|
} else {
|
||||||
|
map += `<img src="assets/img/sprites/grill-char${this.playerDir}.png">`;
|
||||||
|
}
|
||||||
|
} else if (this.mapArray[i][j] === ".") {
|
||||||
|
map += '<img src="assets/img/sprites/grill.png">';
|
||||||
}
|
}
|
||||||
} else if (this.mapArray[i][j] === ".") {
|
|
||||||
map += '<img src="assets/img/sprites/grill.png">';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map += "<br>";
|
map += "<br>";
|
||||||
|
|
|
@ -104,7 +104,12 @@
|
||||||
<a href="#" onclick="toggleDisplay('opts-menu')">settings</a>
|
<a href="#" onclick="toggleDisplay('opts-menu')">settings</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="opts-menu" id="opts-menu">
|
<div class="opts-menu" id="opts-menu">
|
||||||
<a href="#" onclick="toggleDisplay('dpad')">toggle D-Pad</a>
|
<a href="#" onclick="toggleDisplay('dpad')">toggle D-Pad</a><br />
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onclick="if (g.mapInstance.traditional) {g.mapInstance.traditional = false} else {g.mapInstance.traditional = true}; g.mapInstance.display()"
|
||||||
|
>toggle Graphics</a
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<center>
|
<center>
|
||||||
<pre style="margin-top: 30px">
|
<pre style="margin-top: 30px">
|
||||||
|
|
Loading…
Reference in a new issue