I fixed double restart clear
This commit is contained in:
parent
99f7b8a748
commit
54ee9642d3
3 changed files with 5 additions and 5 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,4 +231,4 @@ function pause(o) {
|
|||
prevGameState = gameState;
|
||||
gameState = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue