summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Stevens <nilix@nilfm.cc>2019-04-03 12:46:07 -0700
committerDerek Stevens <nilix@nilfm.cc>2019-04-03 12:46:07 -0700
commitf465b34be027e235081eb68d6a06eec91769a9a8 (patch)
tree50377f4a123b0030d13e229a9a5a17fa23411de5
parent44659fe368e227ef33915adc3a514006c1fb112e (diff)
cleaned up a bit of pausing logic
-rwxr-xr-xEngine.js13
-rw-r--r--Touch.js6
2 files changed, 5 insertions, 14 deletions
diff --git a/Engine.js b/Engine.js
index e82df06..4694c57 100755
--- a/Engine.js
+++ b/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;
diff --git a/Touch.js b/Touch.js
index dc9dcb8..ad37da9 100644
--- a/Touch.js
+++ b/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;
}
}