fix: use platform highscore key in snake

This commit is contained in:
Ferdinand
2026-03-31 14:37:24 +02:00
parent bdc27a4d01
commit 658c1c71c6

View File

@@ -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 {