How do I create a timer for my game?

corgueroicy

New Member
I am building a game in Android 2.2 but I'm struggling to be able to show a timer on screen during play and saving the time to a Leaderboard upon Game Over.I have a game loop and I've extended the SurfaceView to show my graphics.I don't think my game \[code\]loop\[/code\] runs accurately every millisecond so I'm finding it difficult to grab the time.I want to get to having a stored variable called \[code\]time\[/code\] storing the milliseconds and a method called \[code\]getFormattedTime()\[/code\] which would get the time as \[code\]Minutes:Seconds:Milliseconds\[/code\]Whats the best way to do this?
 
Back
Top