blueJ countdown timer
hi, im designing a small game and i kinda wanted to put like a countdown timer in, for example, if the user does something wrong then, a timer wil begin and they will have like 5 minutes to complete the game.
2 do this will i need to write another class etc or is there any function in java.util
i could import and use
thnx chias
[355 byte] By [
chiasa] at [2007-11-27 3:08:31]

o right cool,
so, does this read the clock that is on the pc,
and if this is the case, when the person does something wrong, can i use so that it reads the current time, then perharps add 5 minuets to that, and use an if statement and a while loop:
while time does not equal [time user made a mistake + 5minutes]
if time = time user made a mistake + 5minutes]
end game
i dont know if that makes sence hopefully it will
thnx chias
thnx when i use the methord Calendar.getInstance() it prints out loads of code but it does say what the hours, minute, second is at the end, and if i could get the 'HOUR' 'MINUTE' and 'SECOND' parts out of the Calendar.getInstance() call that would be more useful,
i tried Calendar.getHOUR();
but it says that method doesnt exist
can you give any clues what i need to do
If you just want a simple timer, you don't need the Calendar class, just use basic maths to calculate how many time has elapsed since the first System.currentTimeMillis() invocation,
1 second = 1000 milliseconds
1 minute = 60 seconds = 60 * 1000 milliseconds;
1 hour = 60 minutes = 60*60 seconds = 60*60*1000 milliseconds
Mensaje editado por:
Ruly-o_O