Page 1 of 2

Game Timer/Counter.

PostPosted: Sun Jan 15, 2012 9:15 pm
by DiggyDog
I have been wondering how to make a timer for my game.

I know how to make a simple every tick add one to timer kinda of timer.

But i mean i need the milliseconds and mins counted. But im actually struggling I think its something to do with *dt. But my little brain cannot figure it out.

Im sure a maths savy can figure it out.

Thanks.

Re: Game Timer/Counter.

PostPosted: Sun Jan 15, 2012 9:43 pm
by Kyatric
There's a tutorial on the subject.
I think you can tweak it and adapt it to your needs.

The capx is in the comments.

Re: Game Timer/Counter.

PostPosted: Sun Jan 15, 2012 10:20 pm
by DiggyDog
@Kyatric I tried, But im absolutely failing Can you help me?

Re: Game Timer/Counter.

PostPosted: Sun Jan 15, 2012 10:48 pm
by Yann
post your capx test, it's better if we point out your mistakes, you will learn faster

Re: Game Timer/Counter.

PostPosted: Mon Jan 16, 2012 9:02 pm
by DiggyDog
@Yann, I managed to find this example: http://dl.dropbox.com/u/45711709/Timer.capx

Its exactly what i need except if the seconds go over 60 then it doesn't add a min to the timer, it goes 61,62,63 ect.

Re: Game Timer/Counter.

PostPosted: Mon Jan 16, 2012 9:25 pm
by Yann

Re: Game Timer/Counter.

PostPosted: Mon Jan 16, 2012 9:42 pm
by DiggyDog
@Yann you are truly amazing!!!

For brownie points, How would i get it to say the milliseconds aswell?

Re: Game Timer/Counter.

PostPosted: Mon Jan 16, 2012 9:54 pm
by Yann
probably something like
milliseconds = timer-floor(timer)

Re: Game Timer/Counter.

PostPosted: Mon Jan 16, 2012 10:12 pm
by DiggyDog
Thanks @Yann, Worked Like a charm as usual

Re: Game Timer/Counter.

PostPosted: Sat Jul 07, 2012 4:02 pm
by AnD4D
Sorry, bringing this back to life, but milliseconds doesn't appear to be working for me. If I slow the time down, I can see that the milliseconds actually appears to loop 2-3 times before the seconds tick.

Milliseconds = timer-floor(timer)
right("00"&minutes,2)&" : "&right("00"&seconds,2)&" : "&right("00"&Milliseconds,2)

What am I missing? :(