I made a simple card-memory game, and I want to implement timer/stopwatch (to record fastest time).
Gosu.milliseconds works for the first playthrough, but then just keeps counting.
Can I reset Gosu.milliseconds back to zero or should I use ruby time class (or something else)?
Just save milliseconds to a variable at the beginning of round and then (milliseconds - variable) will be your stopwatch.
it's not that easy, there is an unknown time gap between when the game ends, and when the player click on "play again" button. looks like I'll have to implement custom Stopwatch class (or add 5 extra variables ...). It would be much easier if I could just restart Gosu::milliseconds :/
@start_time = milliseconds
@round_time = milliseconds - @start_time
That's the rough code. You need only 1 variable.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill