cleaned up codebase from not needed experimental code and styles

This commit is contained in:
Patryk Hegenberg 2023-01-10 07:40:23 +01:00
parent 4991e28180
commit 8fd71ae57a
3 changed files with 6 additions and 135 deletions

View file

@ -48,10 +48,9 @@
height: 40,
};
const usePointer = true;
const useArrows = true;
//const usePointer = true;
//const useArrows = true;
const touchOffsetY = -20; // move the center by this much
const scaleMobile = 4; // scale mobile screens by this much
const scaleMonitor = 6; // scale computer screens by this much
const turnLengthMS = 200; // shortest time between turns
@ -515,6 +514,7 @@
} else {
const key = m._x + "," + m._y;
removeMonster(m);
Game.player.stats.xp += 1;
sfx["kill"].play();
return true;
}
@ -605,7 +605,7 @@
msg.push("You hit the monster");
hitter.stats.hp -= 1;
sfx["hit"].play();
Game.player.stats.xp += 1;
//Game.player.stats.xp += 1;
} else {
console.log(false);
sfx["miss"].play();
@ -616,6 +616,7 @@
toast(battleMessage(msg));
}
checkDeath(hitter);
checkDeath(receiver);
showScreen("game");
renderStats(Game.player.stats);
Game.playerAllowedToMove = true;
@ -644,7 +645,6 @@
const p = Game.player;
p.character = "T";
drawTile(Game, p._x + "," + p._y);
const ghost = createGhost([p._x, p._y]);
removeListeners(Game);
sfx["lose"].play();
setTimeout(function () {
@ -659,7 +659,7 @@
*** graphics, UI & browser utils ***
************************************/
const clickevt = !!("ontouchstart" in window) ? "touchstart" : "click";
const clickevt = "click";
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
@ -671,9 +671,6 @@
$("#canvas").appendChild(el);
window.onkeydown = keyHandler;
window.onkeyup = arrowStop;
if (useArrows) {
document.ontouchend = arrowStop;
}
showScreen("game");
}
@ -755,22 +752,6 @@
}
}
// creates the ghost sprite when the player dies
function createGhost(pos) {
const tw = tileOptions.tileWidth;
const th = tileOptions.tileHeight;
const left = "left:" + pos[0] * tw + "px;";
const top = "top:" + pos[1] * th + "px;";
const ghost = el("div", {
className: "sprite ghost free float-up",
style: left + top,
});
ghost.onanimationend = function () {
rmel(ghost);
};
return attach($("#canvas"), ghost);
}
function battleMessage(messages) {
const components = messages.reduce(function (msgs, m) {
return msgs
@ -860,10 +841,6 @@
console.log("Full screen pressed.");
return;
}
if (code == 73) {
toggleInventory(ev, true);
return;
}
if (code == 190) {
Game.engine.unlock();
return;