cleaned up a bit of pausing logic
This commit is contained in:
parent
44659fe368
commit
f465b34be0
2 changed files with 5 additions and 14 deletions
13
Engine.js
13
Engine.js
|
@ -54,7 +54,8 @@ renderer.bg = function()
|
|||
{
|
||||
screen.drawImage(this.gfx.bg, this.bgx, 0);
|
||||
screen.drawImage(this.gfx.bg, this.bgx + 1472, 0);
|
||||
this.bgx -= 8;
|
||||
if (!gameState.paused){
|
||||
this.bgx -= 8;}
|
||||
if (this.bgx == -1472) this.bgx = 0;
|
||||
}
|
||||
|
||||
|
@ -208,9 +209,7 @@ function loop()
|
|||
else
|
||||
{
|
||||
if (!gameState.over){
|
||||
if (gameState.paused) { renderer.bgPaused()}
|
||||
else{
|
||||
renderer.bg()};
|
||||
renderer.bg();
|
||||
if (!gameState.paused)
|
||||
{
|
||||
catbug.move();
|
||||
|
@ -292,11 +291,7 @@ function pressHandler(e)
|
|||
{
|
||||
if (gameState.playing)
|
||||
{
|
||||
if (!gameState.paused)
|
||||
{
|
||||
gameState.paused = true;
|
||||
}
|
||||
else{ gameState.paused = false; }
|
||||
gameState.paused = !gameState.paused
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
6
Touch.js
6
Touch.js
|
@ -145,11 +145,7 @@ function pressPause(e)
|
|||
{
|
||||
if (gameState.playing)
|
||||
{
|
||||
if (!gameState.paused)
|
||||
{
|
||||
gameState.paused = true;
|
||||
}
|
||||
else{ gameState.paused = false; }
|
||||
gameState.paused = !gameState.paused;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue