This site requires JavaScript, please enable it in your browser!
Greenfoot back
roeilthegreat
roeilthegreat wrote ...

2014/8/26

Stopwatch

roeilthegreat roeilthegreat

2014/8/26

#
Hi. So, I've been snooping all around the discussions on how to make a "timer" class but but most of the things I see are clocks that count down. I need a clock that counts up, like a stopwatch. I found a clock demo (http://www.greenfoot.org/scenarios/8157) and it works, but i can't figure out how to stop it then show it at my game's loser screen. Because in my game, instead of scores, my scoring system is how long you've been alive. I also need to find out how to record high scores. tl;dr I need help with making a stopwatch that stops once it's game over and how to record highscores. Thanks to anyone who even bothers reading this. And more thanks to anyone who'll help. P.S. I'll post the code if anyone needs it.
lordhershey lordhershey

2014/8/26

#
This guy made this one http://www.greenfoot.org/scenarios/4013 you can probably use that if you ask.
danpost danpost

2014/8/26

#
You would be better off not to use the System time as the regulating system. Counting act cycles is preferred because it avoids differences in system speed and lagging. In other words, the number of act cycles for any run of the game will not be consistent if using the system time. When using system time, the maximum amount of progress in the game would vary. When counting act cycles, you can still display a stop-watch like counter. I have uploaded Timer Support Class (simple) with source.
You need to login to post a reply.