diff --git a/index.html b/index.html index 518becf..6f2f194 100644 --- a/index.html +++ b/index.html @@ -485,8 +485,22 @@ if (isGameOver()) { $('#gameOver').show(); + var currentHiScore = 0; + + if ($.isNumeric(localStorage.getItem("hiscore"))) { + currentHiScore = parseInt(localStorage.getItem("hiscore")); + } + + if (score > currentHiScore) { + currentHiScore = score; + } + + $('#gameOver .score').text(score); + $('#gameOver .hiscore').text(currentHiScore); + //clear saved game localStorage.clear(); + localStorage.setItem("hiscore", currentHiScore); } } @@ -832,6 +846,7 @@

game over

+

score: personal best:

a game by max bradbury

inspirations include minesweeper, tetris and 2048

tell your friends