Any one know a good way to do a timer, sort of times how long you have been playing the game. Right now im using the Timer from java.util.Timer that uses an ActionListener which i think is whats really hurting me. and lets just say it eats all my CPU… Is there a way to use threads to do it? or another method that wont kill the cpu.
If you don’t display the timer, what about this?
//on start:
long gameStartTime = System.currentTimeMillis();
while(gameRunning) {
// ... game loop with logic and more
}
//this shall be executed when the game has finished
long playedTime = System.currentTimeMillis() - gameStartTime;
didnt know i could do such a thing, that will work just fine
thanks