From 2019e194b4eb62c7de8d971c86a79d5d74517ca3 Mon Sep 17 00:00:00 2001 From: Mees Roelofsz Date: Wed, 13 Dec 2023 15:25:57 +0100 Subject: [PATCH] added constarin to iInput --- web/game.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/game.js b/web/game.js index 38e98fb..ceedf81 100644 --- a/web/game.js +++ b/web/game.js @@ -80,6 +80,7 @@ function score() { function gameOver() { if (lives == 0) { //game over screen + iIndex = constrain(iIndex, 0, 2); isDead = true; push(); fill(255, 0, 0); @@ -137,7 +138,7 @@ async function keyPressed() { } } if (isDead && keyReleasedFlag) { - if ((iIndex < 2) || (iIndex > 0)) { + if ((!(iIndex > 2)) || (!(iIndex < 0))) { if (keyCode == LEFT_ARROW) { iIndex -= 1; keyReleasedFlag = false;