We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm making a simple game where a bunch of objects in an array appear at the same time. Pressing the mouse will remove the array of objects in a class (sample code below). When it hits 0 want it to head into another game State.
void mousePressed() {
if (gameState == RUN_GAME) {
objects.remove(0);
}
}
When it hits 0 and theres no more objects in the sketch and you mouse press, processing automatically freezes. I've tried something like this (below) but it obviously doesn't work. How could I tell the if statement to change the gameState once the array list of objects hit 0? I hope I'm making sense.
void runGame(){
if (objects.length == 0) {
gameState == WINNER);
}
}
Answers
gameState == WINNER);
has syntax errors. It should be:
gameState = WINNER;