Hi! I’m a complete noob in JS and Phaser.
I have this code in the update function:
//if the player fails to catch the veggie and it falls below the floor image cordinate he loses one life.
if (veggie.y > 550 && veggie.x > 150) {
veggie.setVisible(false);
lives -= 1;
}
But when the veggie falls below the floor coordinate the lives continue going down, not stopping, and I get numbers like -346586 lives, looks like I get an infinite loop here. How can I fix it? JS is killing me LOL.
Or maybe I should use a zone overlap or a collider instead of a coordinate?
Thank you so much!