Author |
Message |
Ganan
|
|
|
|
|
Sponsor Sponsor
|
|
|
rdrake
|
Posted: Mon May 07, 2012 8:24 pm Post subject: RE:I need help creating a timer on my pac man isu game due tomorrow! Please help! URGENT!!!! |
|
|
I think posting some code and/or a description of the problem might help immensely. |
|
|
|
|
|
Amarylis
|
Posted: Mon May 07, 2012 8:24 pm Post subject: RE:I need help creating a timer on my pac man isu game due tomorrow! Please help! URGENT!!!! |
|
|
Er, if you're expecting us to give you the answer, you've got the wrong mindset. My only advice will be to take a look at the Time module, and see how you can use it in your program |
|
|
|
|
|
Tony
|
Posted: Mon May 07, 2012 8:41 pm Post subject: RE:I need help creating a timer on my pac man isu game due tomorrow! Please help! URGENT!!!! |
|
|
Chances are that the post got swallowed during the preview.
The easiest way to count "time" is to count the number of frames you draw. In your main loop, just add an increment
code: |
loop
% get input
% move stuff
% draw stuff
timer += 1
end loop
|
The advantages is that it's very easy and gives you discrete numbers to work with (much simpler to understand than fractions of seconds and what "time" really means to a computer program).
The disadvantage is that it assumes that all of your frames take the same amount of time to complete... but for the most part this should be approximately true. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Raknarg
|
Posted: Tue May 08, 2012 11:05 am Post subject: RE:I need help creating a timer on my pac man isu game due tomorrow! Please help! URGENT!!!! |
|
|
Thats why I use different timers for different events |
|
|
|
|
|
Amarylis
|
Posted: Wed May 09, 2012 9:06 pm Post subject: RE:I need help creating a timer on my pac man isu game due tomorrow! Please help! URGENT!!!! |
|
|
I"ve thankfully not needed to use many timers in projects. As a matter of fact, I've never had to use more than 1 timer at any one time, and it was just a 2 minute countdown |
|
|
|
|
|
Raknarg
|
Posted: Thu May 10, 2012 12:40 pm Post subject: RE:I need help creating a timer on my pac man isu game due tomorrow! Please help! URGENT!!!! |
|
|
Well, in some games I have enemies that each need their own timer (shooting and such). having multiple timers isnt bad if you do it right. But if you don't, it could be a nightmare trying to do it all, remembering what does what, etc. |
|
|
|
|
|
|