Update Redditlikespacesuit.HTML
This commit is contained in:
parent
2df3e5cdb4
commit
d0c4419ca7
1 changed files with 4 additions and 2 deletions
|
@ -53,11 +53,11 @@
|
||||||
const invaders = [];
|
const invaders = [];
|
||||||
const invaderWidth = 30;
|
const invaderWidth = 30;
|
||||||
const invaderHeight = 30;
|
const invaderHeight = 30;
|
||||||
const maxInvaders = 2;
|
const maxInvaders = 4;
|
||||||
|
|
||||||
let failedCount = 0;
|
let failedCount = 0;
|
||||||
let score = 0;
|
let score = 0;
|
||||||
let highestScore = 0;
|
let highestScore = localStorage.getItem("highestScore") || 0;
|
||||||
|
|
||||||
const leftArrowButton = document.getElementById("left-arrow");
|
const leftArrowButton = document.getElementById("left-arrow");
|
||||||
const rightArrowButton = document.getElementById("right-arrow");
|
const rightArrowButton = document.getElementById("right-arrow");
|
||||||
|
@ -186,6 +186,7 @@
|
||||||
alert("You failed, try again");
|
alert("You failed, try again");
|
||||||
if (score > highestScore) {
|
if (score > highestScore) {
|
||||||
highestScore = score;
|
highestScore = score;
|
||||||
|
localStorage.setItem("highestScore", highestScore);
|
||||||
highestScoreDisplay.textContent = highestScore;
|
highestScoreDisplay.textContent = highestScore;
|
||||||
}
|
}
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
|
@ -202,6 +203,7 @@
|
||||||
requestAnimationFrame(updateGameArea);
|
requestAnimationFrame(updateGameArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
highestScoreDisplay.textContent = highestScore;
|
||||||
updateGameArea();
|
updateGameArea();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Add table
Reference in a new issue