1
0
Fork 0

Add speed display

This commit is contained in:
Ethanell 2021-03-27 11:08:55 +01:00
parent 4af6a0602f
commit d7ada21496
2 changed files with 3 additions and 0 deletions

View file

@ -12,6 +12,7 @@
<div class="col s2">
<p class="stats" id="score">Score: </p>
<p class="stats" id="lives">Lives: </p>
<p class="stats" id="speed">Speed: </p>
</div>
<div class="col s8">
<h1 class="linear-wipe">KyFlo Snake</h1>

View file

@ -9,6 +9,7 @@ const lives = document.getElementById("lives");
const gameOver = document.getElementById("gameovermodal");
const scoreBoard = document.getElementById("scoreboard");
const playerName = document.querySelector("input");
const speed = document.getElementById("speed");
const audio = new Audio("sources/sound/main.mp3");
const startSound = new Audio("sources/sound/onStart.mp3");
const eatSound = new Audio("sources/sound/onEat.mp3");
@ -107,6 +108,7 @@ function loadGame(data) {
function updateScore(s) {
score.innerText = `Score: ${s}`;
speed.innerText = `Speed: ${game.snakeSpeed} ms`;
}
function updateLives(l) {