🎓🦂 Checkpoint

./index.html:9517054/373
./script.js:9517054/16
This commit is contained in:
Glitch (glitch-hello-website) 2022-03-01 18:26:02 +00:00
parent 270622ad66
commit d1ad242ae3
2 changed files with 2 additions and 3 deletions

View file

@ -13,8 +13,7 @@
<canvas id="canvas" height="375" width="375"></canvas> <canvas id="canvas" height="375" width="375"></canvas>
<br /><br /> <br /><br />
<span id="info">welcome to snek!</span><br /> <span id="info">welcome to snek!</span><br />
<span id="highscore"></span><br /> <span id="highscore"></span>
<br />
<ul> <ul>
<li>use arrow keys to move the snek</li> <li>use arrow keys to move the snek</li>
<li>try to eat the apple</li> <li>try to eat the apple</li>

View file

@ -100,7 +100,7 @@ function update() {
const score = b.length - 5; const score = b.length - 5;
if(score > game.highscore) game.highscore = score; // update high score if necessary if(score > game.highscore) game.highscore = score; // update high score if necessary
info.innerText = `${score < 15 ? "length" : "longth"}: ${score}`; info.innerText = `${score < 15 ? "length" : "longth"}: ${score}`;
highscore.innerText = `highscore: ${game.highscore}`; highscore.innerText = `highscore: ${game.highscore}\n`;
} }
// calculate where the snek will move to // calculate where the snek will move to