cleaned up a bit of pausing logic

This commit is contained in:
Iris Lightshard 2019-04-03 12:46:07 -07:00
parent 44659fe368
commit f465b34be0
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 5 additions and 14 deletions

View file

@ -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;

View file

@ -145,11 +145,7 @@ function pressPause(e)
{
if (gameState.playing)
{
if (!gameState.paused)
{
gameState.paused = true;
}
else{ gameState.paused = false; }
gameState.paused = !gameState.paused;
}
}