This is the "timer" part of my act method in my world subclass:
and this is showTime:
and I have this before the act method:
The problem is that when the timer ends (going for 25 seconds) and the game stops, instead of reading Time: 0.00 like it's supposed to, it reads Time: 0.02 and I haven't a clue why. This tiny little thing is bothering me so much.
If you have any ideas, I would appreciate it!
showTime();
if(timer!=0.00){
timer --;
if(timer == 0.00){ //player runs out of time
Greenfoot.stop();
failed(); // displays text saying "try again"
Greenfoot.playSound("fail.mp3");
}
}private void showTime(){
showText("Time: "+(seconds.format(timer/60.0)), 60, 20);
}private double timer = 1500.0;
DecimalFormat seconds = new DecimalFormat("#.00");
