|
-
Question about getTimer();
Hey everyone,
Ok so I have this timer that counts the seconds that go by:
time = Math.floor(getTimer()/1000);
And basically Im using this to check how many seconds go by before something happens. I do this by:
if (time/orangeRandom == 1) {
So I check if time divided by a number equals 1. If so, then I know that a certain amount of seconds have gone by and I can move on to do something in the IF statment.
But my problem then comes later on , I need to know if its possible to reset the timer back to 0.
It seems that the function getTimer(); is always constantly going as soon as you call it I cant figure out how to start it back at 0. I probably could work around it, but this is the easiest way I can see, fastest and also would contain the least amount of code.
If someone could give me a boost , it would be appreciated
-
Flash Gordon
the getTimer() always gives you the time in millisecons since the flash started.
If you need a time difference, you would need to remember some start time
and check that against the current time...
starttime = getTimer();
timedif = getTimer()-starttime;
is such an approach
My letters on the F1 key have faded, how are yours today?
-
Hey McUsher,
I think thats exactly what I need. Im going to give it a try.
Many thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|