fixed pausing
This commit is contained in:
parent
1f068080e3
commit
e2d9458e66
1 changed files with 10 additions and 2 deletions
|
@ -200,7 +200,12 @@ function updateHighScores (){
|
||||||
$("#2place").text(highscores[1]);
|
$("#2place").text(highscores[1]);
|
||||||
$("#3place").text(highscores[2]);
|
$("#3place").text(highscores[2]);
|
||||||
}
|
}
|
||||||
|
var pausable = true;
|
||||||
function pause(o) {
|
function pause(o) {
|
||||||
|
if(!pausable){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pausable = false;
|
||||||
writeHighScores();
|
writeHighScores();
|
||||||
var message;
|
var message;
|
||||||
if (o) {
|
if (o) {
|
||||||
|
@ -223,7 +228,8 @@ function pause(o) {
|
||||||
hideText();
|
hideText();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
gameState = prevGameState;
|
gameState = prevGameState;
|
||||||
}, 200)
|
pausable =true;
|
||||||
|
}, 300);
|
||||||
} else if (gameState != -2 && gameState !== 0 && gameState !== 2) {
|
} else if (gameState != -2 && gameState !== 0 && gameState !== 2) {
|
||||||
$('#restartBtn').fadeIn(150, "linear");
|
$('#restartBtn').fadeIn(150, "linear");
|
||||||
$('#buttonCont').fadeIn(150, "linear");
|
$('#buttonCont').fadeIn(150, "linear");
|
||||||
|
@ -232,9 +238,11 @@ function pause(o) {
|
||||||
showText(message);
|
showText(message);
|
||||||
}
|
}
|
||||||
$('#fork-ribbon').fadeIn(150, 'linear');
|
$('#fork-ribbon').fadeIn(150, 'linear');
|
||||||
|
|
||||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||||
prevGameState = gameState;
|
prevGameState = gameState;
|
||||||
|
setTimeout(function() {
|
||||||
|
pausable = true;
|
||||||
|
}, 300);
|
||||||
gameState = -1;
|
gameState = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue