I fixed double restart clear
This commit is contained in:
parent
344d42aceb
commit
34087504da
3 changed files with 5 additions and 5 deletions
|
@ -51,7 +51,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
||||||
//slate for final deletion
|
//slate for final deletion
|
||||||
this.opacity = 0;
|
this.opacity = 0;
|
||||||
this.deleted = 2;
|
this.deleted = 2;
|
||||||
if (gameState == 1) {
|
if (gameState == 1 || gameState==0) {
|
||||||
localStorage.setItem("saveState", exportSaveState());
|
localStorage.setItem("saveState", exportSaveState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ function Block(fallingLane, color, iter, distFromHex, settled) {
|
||||||
|
|
||||||
if (this.tint) {
|
if (this.tint) {
|
||||||
if (this.opacity < 1) {
|
if (this.opacity < 1) {
|
||||||
if (gameState == 1) {
|
if (gameState == 1 || gameState==0) {
|
||||||
localStorage.setItem("saveState", exportSaveState());
|
localStorage.setItem("saveState", exportSaveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ function initialize(a) {
|
||||||
document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
|
document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
|
||||||
$(window).resize(scaleCanvas);
|
$(window).resize(scaleCanvas);
|
||||||
$(window).unload(function(){
|
$(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();
|
else localStorage.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -192,4 +192,4 @@ function handleTap(e) {
|
||||||
|
|
||||||
function handleClick(e) {
|
function handleClick(e) {
|
||||||
handleClickTap(e.clientX);
|
handleClickTap(e.clientX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,4 +231,4 @@ function pause(o) {
|
||||||
prevGameState = gameState;
|
prevGameState = gameState;
|
||||||
gameState = -1;
|
gameState = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue