HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Which is better

03-08-2008, 06:59 PM#1
TheSecretArts
Which is faster/cleaner?:
using a timer that last .01 seconds to execute a function
or
using the periodic event for every .01 seconds
03-08-2008, 07:17 PM#2
Rising_Dusk
Quote:
using a timer that last .01 seconds to execute a function
or
using the periodic event for every .01 seconds
If you absolutely must use one or the other, the timer is better since the periodic event uses a timer internally. However, nothing in the universe needs to be run on a 0.01 timer, even the smoothest of movements can be achieved on around 0.04 second intervals.
03-08-2008, 07:25 PM#3
TheSecretArts
Ok, but does the periodic event leak?
03-08-2008, 07:30 PM#4
moyack
It depends in what you want, if you need this timer to sart it and never stop it, you can use any option, but if you need to start and stop easily, a timer is the best option.

Personally I love to do all my stuff with timers, even when I know that i won't stop them in all the game.

About periods, 0.04 is the best option for physic movement, 0.1 for effects over time.

Quote:
Ok, but does the periodic event leak?
They always leak, but it doesn't matter, because they are done only once, so no worries.
03-08-2008, 07:45 PM#5
TheSecretArts
ok, I switched over to a controlled timer at .04