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

2012/4/16

Hello all I will stop the game in like 60 seconds but How can I do that

1
2
trash1000 trash1000

2012/4/17

#
          
        public void act() {  
            if((System.currentTimeMillis() - initialTime) /1000 == 60) {  
                //Put your code here that you want to happen when the game ends  
                Greenfoot.stop();  
            }  
        }  
Just to show you another option.
martijn13039 martijn13039

2012/4/17

#
I wil thank you for your big help but I have one more problem and I hope you can help me with this last problem If the time is on I wil that greenfoot is game over and go to the hiscore but if I put gameOver(); in the code there stay cannont find symbol- method gameover I think this is a very stupid question and I will appoliges me for that but I hope you wil help me thx martijn
mport greenfoot.*;  

public class TimeChecker extends Actor 
{    
 long initialTime; 



 public TimeChecker() 
 {         
 initialTime = System.currentTimeMillis();    
}
  public void act() 
  {         
  if(System.currentTimeMillis() > initialTime + 60000) 
  
  Greenfoot.stop();        
}      

}  
 
martijn13039 martijn13039

2012/4/17

#
I hope That you understand ent I mean (and TNS for THE lot of help you all given to me)
martijn13039 martijn13039

2012/4/17

#
Oow sorry TNS is thx (pc change it automatic)
You need to login to post a reply.
1
2