From 34087504da7711d6e7a186e4dfb270809e36e78b Mon Sep 17 00:00:00 2001 From: Garrett Finucane Date: Sat, 19 Jul 2014 19:12:28 -0400 Subject: [PATCH] I fixed double restart clear --- js/Block.js | 4 ++-- js/initialization.js | 4 ++-- js/view.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/Block.js b/js/Block.js index e4ae89c..256417b 100644 --- a/js/Block.js +++ b/js/Block.js @@ -51,7 +51,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) { //slate for final deletion this.opacity = 0; this.deleted = 2; - if (gameState == 1) { + if (gameState == 1 || gameState==0) { localStorage.setItem("saveState", exportSaveState()); } } @@ -143,7 +143,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) { if (this.tint) { if (this.opacity < 1) { - if (gameState == 1) { + if (gameState == 1 || gameState==0) { localStorage.setItem("saveState", exportSaveState()); } diff --git a/js/initialization.js b/js/initialization.js index d5469b3..c839389 100644 --- a/js/initialization.js +++ b/js/initialization.js @@ -170,7 +170,7 @@ function initialize(a) { document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false); $(window).resize(scaleCanvas); $(window).unload(function(){ - if(gameState ==1 || gameState ==-1) localStorage.setItem("saveState", exportSaveState()); + if(gameState ==1 || gameState ==-1 || gameState ==0) localStorage.setItem("saveState", exportSaveState()); else localStorage.clear(); }); @@ -192,4 +192,4 @@ function handleTap(e) { function handleClick(e) { handleClickTap(e.clientX); -} \ No newline at end of file +} diff --git a/js/view.js b/js/view.js index d45f2b3..700a56e 100644 --- a/js/view.js +++ b/js/view.js @@ -231,4 +231,4 @@ function pause(o) { prevGameState = gameState; gameState = -1; } -} \ No newline at end of file +}