PDA

View Full Version : quick help plz [game time counter]



Lippuzz_
March 31st, 2005, 05:28 AM
can anybody help to make a gameplay time counter?
i did make one but it only showed seconds and milisecons (with gettimer())).
As soon as the player hit the button "submit" the time has to start to count. As the player reached his maximum turns the game goed to the next frame and the timer should top. The game starts over (from frame2) so the timer has to begin over again.

ghjr
March 31st, 2005, 08:17 AM
Put an action on the submit button that calls the getTimer() function, like:



on (press) {
startTime = getTimer();
}


Then you make an onEnterFrame or something similar to keep creating a variable with the current time and also checking to see if the startTime + currentTime is equal to the total time you want to allow.

EDIT: To show it as minutes, just make a function that changes the time display every 60,000 milliseconds. There may be a better way to accomplish that though.


Cheers!

Lippuzz_
April 2nd, 2005, 04:44 AM
thanks for the help. but another thing i noticed is that the gettimer function is that it is faster on one computer than on another

Shimi
April 2nd, 2005, 04:54 AM
Well its the same as the setInterval function depends on the system
when the cpu is overloaded i guess the setInterval will be drunk function lol

ghjr
April 4th, 2005, 12:19 PM
thanks for the help. but another thing i noticed is that the gettimer function is that it is faster on one computer than on another

Maybe thats a good thing. Players on slower PCs have a handicap hehe! :thumb:

Cheers!