Skip to content

Commit af683a7

Browse files
clear game state on game over
1 parent bf1ba51 commit af683a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

js/game_manager.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ GameManager.prototype.actuate = function () {
8383
this.storageManager.setBestScore(this.score);
8484
}
8585

86-
this.storageManager.setGameState(this.serialize());
86+
// Clear the state when the game is over (game over only, not win)
87+
if (this.over) {
88+
this.storageManager.clearGameState();
89+
} else {
90+
this.storageManager.setGameState(this.serialize());
91+
}
8792

8893
this.actuator.actuate(this.grid, {
8994
score: this.score,

0 commit comments

Comments
 (0)