added constarin to iInput
This commit is contained in:
@@ -80,6 +80,7 @@ function score() {
|
|||||||
function gameOver() {
|
function gameOver() {
|
||||||
if (lives == 0) {
|
if (lives == 0) {
|
||||||
//game over screen
|
//game over screen
|
||||||
|
iIndex = constrain(iIndex, 0, 2);
|
||||||
isDead = true;
|
isDead = true;
|
||||||
push();
|
push();
|
||||||
fill(255, 0, 0);
|
fill(255, 0, 0);
|
||||||
@@ -137,7 +138,7 @@ async function keyPressed() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isDead && keyReleasedFlag) {
|
if (isDead && keyReleasedFlag) {
|
||||||
if ((iIndex < 2) || (iIndex > 0)) {
|
if ((!(iIndex > 2)) || (!(iIndex < 0))) {
|
||||||
if (keyCode == LEFT_ARROW) {
|
if (keyCode == LEFT_ARROW) {
|
||||||
iIndex -= 1;
|
iIndex -= 1;
|
||||||
keyReleasedFlag = false;
|
keyReleasedFlag = false;
|
||||||
|
Reference in New Issue
Block a user