some major game changes

This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent edc5193746
commit f0afee03ab
3 changed files with 26 additions and 7 deletions

View file

@ -131,6 +131,9 @@ class Game extends GameBasic {
textArgs = [`XY: ${-Math.round(player.camera.x)}, ${-Math.round(player.camera.y)}`, 25, 25];
ctx.strokeText(...textArgs);
ctx.fillText(...textArgs);
textArgs = [`PT: ${Math.round(player.headCount)}`, 25, 75];
ctx.strokeText(...textArgs);
ctx.fillText(...textArgs);
if (player.health <= 0 || player.isMenu) {
this.doMenu();
@ -145,7 +148,10 @@ class Game extends GameBasic {
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "bold 48px sans-serif";
if (player.health <= 0) ctx.fillText('You died! Click to respawn', cs / 2, cs / 2);
if (player.health <= 0) {
ctx.fillText(`You died! Click to respawn\n`, cs / 2, cs / 2);
return;
}
if (player.isMenu) {
let r = Math.floor(Math.abs(player.rot / 1.2) % emojis.length);
ctx.fillText(`Click to react ${emojis[r]}`, cs / 2, cs / 2)
@ -298,7 +304,7 @@ class Game extends GameBasic {
let sant = document.querySelector('.lb').innerHTML;
sant = sant.replaceAll(/\[([^\[]+)\]/g,'<span class="score">[<span class="score-content">$1</span>]</span>');
sant = sant.replaceAll(/\[([^\[]+)\]/g, '<span class="score">[<span class="score-content">$1</span>]</span>');
document.querySelector('.lb').innerHTML = sant;
}