Posted By
|
Message
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
4th September, 2007 at 10:57:42 -
A trick title, with an interesting problem.
I ask, has anyone here ever made a game where the length of time played determined the outcome or which ending you get? Ex. Super Metroid, Castlevanias.
I know that in general the MMF timer isn't all that reliable for every computer, but would the best way to keep track of a player's time he played the game involve it? I figure I'd do something like this:
Every 1 second, add 1 to variable "second"
If "second" >= 60 then "second" = 0 : "minute" = "minute" + 1
If "minute" >= 60 then "minutes" = 0: "hour" = "hour" + 1
Unless there's some secret MMF trick that does it better, is this the best way?
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
|
4th September, 2007 at 11:17:07 -
Since the framerate is fixed to 50 FPS, a more accurate solution could be:
Always: add 1 to counter (you might want to consider making the counter global so it'd count parts of seconds!)
Counter >= 50: add 1 to "seconds" counter/global var.
You do not have to count minutes: use (counter mod 60) to get the amount of minutes.
Old member (~2004-2007).
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
4th September, 2007 at 13:42:41 -
YES!
I knew there was a reason I keep you in my employ, DaVince!
Thank you
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
|
4th September, 2007 at 14:54:15 -
Haha, thanks.
And I forgot, here's the formula to get the seconds out of the time when it's > 60 seconds:
Floor(seconds_counter / 60)
I actually have LIJI to thank for that bit (though it was about positioning objects rather than getting seconds).
Old member (~2004-2007).
|
Knudde (Shab) Administrator
Crazy?
Registered 31/01/2003
Points 5125
|
5th September, 2007 at 18:10:31 -
I never made how long you played give you a different ending, but I did have a timer like this in the way back version of core. It wasn't horribly accurate, but I used timers, as every time I check how many loops are running a second, it was between 46-48 a second, not a solid 50.
Craps, I'm an old man!
|
|
|