public void act() { if((System.currentTimeMillis() - initialTime) /1000 == 60) { //Put your code here that you want to happen when the game ends Greenfoot.stop(); } }
public void act() { if((System.currentTimeMillis() - initialTime) /1000 == 60) { //Put your code here that you want to happen when the game ends Greenfoot.stop(); } }
mport greenfoot.*; public class TimeChecker extends Actor { long initialTime; public TimeChecker() { initialTime = System.currentTimeMillis(); } public void act() { if(System.currentTimeMillis() > initialTime + 60000) Greenfoot.stop(); } }