From af683a7856485d8be156c3e070fdb7c9baff0145 Mon Sep 17 00:00:00 2001 From: Gabriele Cirulli Date: Sat, 22 Mar 2014 18:33:24 +0100 Subject: [PATCH] clear game state on game over --- js/game_manager.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/game_manager.js b/js/game_manager.js index f60fd2d..1cab434 100644 --- a/js/game_manager.js +++ b/js/game_manager.js @@ -83,7 +83,12 @@ GameManager.prototype.actuate = function () { this.storageManager.setBestScore(this.score); } - this.storageManager.setGameState(this.serialize()); + // Clear the state when the game is over (game over only, not win) + if (this.over) { + this.storageManager.clearGameState(); + } else { + this.storageManager.setGameState(this.serialize()); + } this.actuator.actuate(this.grid, { score: this.score, -- GitLab