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..


1 | if (System.currentTimeMillis() - startTime > timeLimit) { } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | //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 ; |