PDA

View Full Version : NSTimer Running always or somtimes


unknown
2005.07.27, 11:31 AM
Im making a grid based game and im wating to animate the characters move for a short time after a key is pressed, should I start an NSTimer each time a key is pressed or have one always running?

ThemsAllTook
2005.07.27, 12:44 PM
Completely up to you. You'd get the same effect either way. Personally, I'd leave a timer running all the time, because I'd only have to set it up once, and would most likely use it for other things in the future. If you fire off a new timer each time you need one, you'll probably waste less CPU time, but the amount that it would use in the first place is so small that this is irrelevant.

So, do whichever seems the most logical to you.

- Alex Diener

kodex
2005.07.27, 04:27 PM
I would personally keep one running the whole time too, NSTimer takes up very little processing power and create and dealloc it over and over again seems like a headache you dont need to put yourself through. But either way will work just fine.

unknown
2005.07.27, 04:49 PM
It not me with the headache, it my computer and it doesnt seem to mind.
I guess I better try the other one though, seeing as it does seem like the better option, thanks guys.