fixed pause button
This commit is contained in:
parent
27b3923d88
commit
a2df6064be
4 changed files with 10 additions and 11 deletions
|
@ -82,8 +82,7 @@
|
|||
</div>
|
||||
<img id="openSideBar" class = 'helpText' src="./images/btn_help.svg" />
|
||||
<div class="faded overlay"></div>
|
||||
<div id = 'pauseBtn'><div id = 'pauseBtnInner'><img src="./images/btn_pause.svg" /></div></div>
|
||||
<div id = 'pauseBtn'><div id = 'pauseBtnInner'><img src="./images/btn_pause.svg" /></div></div>
|
||||
<img id="pauseBtn" src="./images/btn_pause.svg" />
|
||||
<div id = 'restartBtn'><div id = 'restartBtnInner'><img src="./images/btn_restart.svg" /></div></div>
|
||||
<div id="bottombar">
|
||||
<div style="bottom:4px; padding-right:4px;" class="fb-like" data-href="http://hextris.github.io/hextris" data-width="20" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
|
||||
|
|
|
@ -75,6 +75,8 @@ function addKeyListeners() {
|
|||
});
|
||||
|
||||
$("#pauseBtn").on('touchstart mousedown', function() {
|
||||
|
||||
alert("hey");
|
||||
if (gameState != 1 && gameState != -1) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +84,6 @@ function addKeyListeners() {
|
|||
if ($('#helpScreen').is(":visible")) {
|
||||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
alert("hey");
|
||||
pause();
|
||||
return false;
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@ function init(b) {
|
|||
}
|
||||
|
||||
infobuttonfading = true;
|
||||
$("#pauseBtnInner").html('<img src="./images/btn_pause.svg">');
|
||||
$("#pauseBtn").html('<img src="./images/btn_pause.svg">');
|
||||
hideUIElements();
|
||||
var saveState = localStorage.getItem("saveState") || "{}";
|
||||
saveState = JSONfn.parse(saveState);
|
||||
|
@ -331,7 +331,7 @@ function showHelp() {
|
|||
pause();
|
||||
}
|
||||
|
||||
if($("#pauseBtnInner").children()[0].src.replace(/^.*[\\\/]/, '') == "btn_pause.svg" && gameState != 0 && !infobuttonfading) {
|
||||
if($("#pauseBtn").children()[0].src.replace(/^.*[\\\/]/, '') == "btn_pause.svg" && gameState != 0 && !infobuttonfading) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,10 +155,10 @@ function setMainMenu() {
|
|||
canRestart = 's';
|
||||
}, 500);
|
||||
$('#restartBtn').hide();
|
||||
if ($($("#pauseBtn").children()[0]).replace(/^.*[\\\/]/, '') == "btn_pause.svg") {
|
||||
$("#pauseBtnInner").html('<img src="./images/btn_pause.svg" />');
|
||||
if ($("#pauseBtn").replace(/^.*[\\\/]/, '') == "btn_pause.svg") {
|
||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||
} else {
|
||||
$("#pauseBtnInner").html('<img src="./images/btn_resume.svg" />');
|
||||
$("#pauseBtn").attr("src","./images/btn_pause.svg");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,6 @@ function gameOverDisplay() {
|
|||
}
|
||||
|
||||
function pause(o) {
|
||||
alert("pausing");
|
||||
writeHighScores();
|
||||
var message;
|
||||
if (o) {
|
||||
|
@ -231,7 +230,7 @@ function pause(o) {
|
|||
$('#helpScreen').fadeOut(150, "linear");
|
||||
}
|
||||
|
||||
$("#pauseBtnInner").html('<img src="./images/btn_resume.svg" />');
|
||||
$("#pauseBtn").attr("src", "./images/btn_pause.svg");
|
||||
$('.helpText').fadeOut(200, 'linear');
|
||||
hideText();
|
||||
hidebottombar();
|
||||
|
@ -246,7 +245,7 @@ function pause(o) {
|
|||
showText(message);
|
||||
}
|
||||
|
||||
$("#pauseBtnInner").html('<img src="./images/btn_resume.svg" />');
|
||||
$("#pauseBtn").attr("src","./images/btn_resume.svg");
|
||||
prevGameState = gameState;
|
||||
gameState = -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue