Help me please it is a project for my VGP class and it due tomoorow at midnight.. any help would be greatly appreciated. i cant figure out how to add a time limit for my memory card game..
if (System.currentTimeMillis() - startTime > timeLimit) { }//Declare this field:
private int timer = 0;
//Include this in your act() method:
public void act()
{
//Your code
timer++;
}
//And then have this somewhere:
if(timer > 1000) //Replace 1000 with your limit
{
//Do whatever
}
//To reset the timer, just do:
timer = 0;