In my game if the car hits the house it gets a gameover/you win screen. I used this code to do that.
I tried to do something similar with the counter.
It says can not find symbol variable counter. So how can I make it so that if the counter = 0 it shows the you lose screen.
1 2 3 4 5 6 7 | if (isTouching(House. class )) { World myWorld = getWorld(); GameOver gameover = new GameOver(); myWorld.addObject(gameover, myWorld.getWidth()/ 2 , myWorld.getHeight() / 2 ); } |
1 2 3 4 5 6 7 | if (counter= 0 ) { World myWorld = getWorld(); YouLose youlose = new YouLose(); myWorld.addObject(youlose, myWorld.getWidth()/ 2 , myWorld.getHeight() / 2 ); } |