I’ve got a countdown clock, which appears above an object in my game that has been planted/started to be built.
I’m using the Sparrow Framework.
Right now I’m just running a method in the onEnterFrame, that checks every frame (I’ve actually set it to every other frame but anyway) and updates the countdown clock, but I’m wondering if this is just a slow and inefficient way to do this.
Is there a way to update my counter, without it clogging things up?
I should add there will be a number of these countdown clocks on the game screen.
A different approach would be to use a NSTimer that ticks at the same interval as you want your countdown counter to decrease at. Each tick you decrement the counter and call
setNeedsDisplay.If all you are doing is checking if the value of the countdown has changed
onEnterFrame, and redrawing if the counter has changed, then you should be fine.