Add speed display
This commit is contained in:
parent
4af6a0602f
commit
d7ada21496
2 changed files with 3 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
||||||
<div class="col s2">
|
<div class="col s2">
|
||||||
<p class="stats" id="score">Score: </p>
|
<p class="stats" id="score">Score: </p>
|
||||||
<p class="stats" id="lives">Lives: </p>
|
<p class="stats" id="lives">Lives: </p>
|
||||||
|
<p class="stats" id="speed">Speed: </p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s8">
|
<div class="col s8">
|
||||||
<h1 class="linear-wipe">KyFlo Snake</h1>
|
<h1 class="linear-wipe">KyFlo Snake</h1>
|
||||||
|
|
|
@ -9,6 +9,7 @@ const lives = document.getElementById("lives");
|
||||||
const gameOver = document.getElementById("gameovermodal");
|
const gameOver = document.getElementById("gameovermodal");
|
||||||
const scoreBoard = document.getElementById("scoreboard");
|
const scoreBoard = document.getElementById("scoreboard");
|
||||||
const playerName = document.querySelector("input");
|
const playerName = document.querySelector("input");
|
||||||
|
const speed = document.getElementById("speed");
|
||||||
const audio = new Audio("sources/sound/main.mp3");
|
const audio = new Audio("sources/sound/main.mp3");
|
||||||
const startSound = new Audio("sources/sound/onStart.mp3");
|
const startSound = new Audio("sources/sound/onStart.mp3");
|
||||||
const eatSound = new Audio("sources/sound/onEat.mp3");
|
const eatSound = new Audio("sources/sound/onEat.mp3");
|
||||||
|
@ -107,6 +108,7 @@ function loadGame(data) {
|
||||||
|
|
||||||
function updateScore(s) {
|
function updateScore(s) {
|
||||||
score.innerText = `Score: ${s}`;
|
score.innerText = `Score: ${s}`;
|
||||||
|
speed.innerText = `Speed: ${game.snakeSpeed} ms`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLives(l) {
|
function updateLives(l) {
|
||||||
|
|
Reference in a new issue