Hello! I am trying to make it so that when you press a button (Buttons class with Falsebutton/Truebutton subclasses under it) 5 times, the program stops. How do I do this?


1 | public static int clicks; |
1 | clicks = 0 ; |
1 | MyWorld.clicks++; |
1 | if (clicks == 5 ) Greenfoot.stop(); |