This site requires JavaScript, please enable it in your browser!
Greenfoot back
AntoniaPopa
AntoniaPopa wrote ...

2017/2/10

How to end the game when a score reaches a certain number?

AntoniaPopa AntoniaPopa

2017/2/10

#
How to end the game when a score reaches a certain number? I want my game to end when I reach -4
Super_Hippo Super_Hippo

2017/2/10

#
if (score == -4) 
{
    Greenfoot.stop();
    //or add GameOver Screen or something
}
AntoniaPopa AntoniaPopa

2017/2/10

#
"Cannot find symbol - variable score"
Nosson1459 Nosson1459

2017/2/10

#
make a score variable or whatever variable you have for score and then use that for what super hippo said to do theres no score variable built into Greenfoot.
Super_Hippo Super_Hippo

2017/2/10

#
Yes, you need a score variable:
private int score = 0;
Or similar. I thought that you already have the score.
You need to login to post a reply.