fix: use platform highscore key in snake
This commit is contained in:
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
let snake, dir, nextDir, food, score, highscore, running, paused, animId;
|
let snake, dir, nextDir, food, score, highscore, running, paused, animId;
|
||||||
|
|
||||||
highscore = parseInt(localStorage.getItem('snake_hs') || '0');
|
highscore = getHighscore('snake');
|
||||||
highscoreEl.textContent = highscore;
|
highscoreEl.textContent = highscore;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -109,7 +109,6 @@
|
|||||||
if (score > highscore) {
|
if (score > highscore) {
|
||||||
highscore = score;
|
highscore = score;
|
||||||
highscoreEl.textContent = highscore;
|
highscoreEl.textContent = highscore;
|
||||||
localStorage.setItem('snake_hs', highscore);
|
|
||||||
}
|
}
|
||||||
spawnFood();
|
spawnFood();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user