I fixed double restart clear

This commit is contained in:
Garrett Finucane 2014-07-19 19:12:28 -04:00
parent 344d42aceb
commit 34087504da
3 changed files with 5 additions and 5 deletions

View file

@ -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());
}

View file

@ -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();
});