1 2 3 4 5 6 | public void act() { if ((System.currentTimeMillis() - initialTime) / 1000 == 60 ) { //Put your code here that you want to happen when the game ends Greenfoot.stop(); } } |


1 2 3 4 5 6 | public void act() { if ((System.currentTimeMillis() - initialTime) / 1000 == 60 ) { //Put your code here that you want to happen when the game ends Greenfoot.stop(); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | mport greenfoot.*; public class TimeChecker extends Actor { long initialTime; public TimeChecker() { initialTime = System.currentTimeMillis(); } public void act() { if (System.currentTimeMillis() > initialTime + 60000 ) Greenfoot.stop(); } } |