--- a/game.js 2026-10-30 18:04:00.212623475 -0300 +++ b/game.js 2026-10-30 18:04:30.573343060 -0300 @@ -317,24 +317,25 @@ // LEADERBOARD // ============================================================ +// FredyGames: the online leaderboard (snakelike-leaderboard.vercel.app) is gone; the high scores are +// kept in this browser's localStorage instead, with the same entry shape ({ name, score, ... }). +const LOCAL_SCORES_KEY = 'snakelike_scores'; + async function fetchLeaderboard() { try { - const resp = await fetch('https://snakelike-leaderboard.vercel.app/api/leaderboard'); - const data = await resp.json(); - if (!data.dreamlo || !data.dreamlo.leaderboard || !data.dreamlo.leaderboard.entry) return []; - const entries = data.dreamlo.leaderboard.entry; - return Array.isArray(entries) ? entries : [entries]; + const entries = JSON.parse(localStorage.getItem(LOCAL_SCORES_KEY) || '[]'); + return Array.isArray(entries) ? entries : []; } catch (e) { return []; } } async function submitToLeaderboard(name, score, level, kills, maxLength) { - return fetch('https://snakelike-leaderboard.vercel.app/api/leaderboard', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ name, score, level, kills, maxLength }), - }); + const entries = await fetchLeaderboard(); + entries.push({ name, score, level, kills, maxLength }); + entries.sort((a, b) => Number(b.score) - Number(a.score)); + try { localStorage.setItem(LOCAL_SCORES_KEY, JSON.stringify(entries.slice(0, LEADERBOARD_SIZE))); } + catch (e) {} } function getPersonalBest() { @@ -1685,7 +1686,7 @@ } showLeaderboardSection(cx, topY) { - const loadingText = this.add.text(cx, topY, 'Loading leaderboard...', { + const loadingText = this.add.text(cx, topY, 'Loading high scores...', { fontFamily: 'monospace', fontSize: '14px', color: '#555555' }).setOrigin(0.5); --- a/index.html 2026-10-30 18:04:00.213154030 -0300 +++ b/index.html 2026-10-30 18:04:30.573732320 -0300 @@ -4,6 +4,7 @@