added constarin to iInput

This commit is contained in:
Mees Roelofsz
2023-12-13 15:25:57 +01:00
parent 420439dead
commit 2019e194b4

View File

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