I want a sprite that “blinks” so that it displays frame 1 for say 2 seconds and then displays frame 2 for 0.1 second and then displays frame 1 for 2 seconds again and repeats for ever. Now I can code this with CCDelayTime and build this logic my self, but it would be so nice if I could get CCAnimation to handle this or if there was a cleaner way.
Is there a way to create a CCAnimation with different delays between frames, or what is the best/easy way to archive my goal?
Thank you
Søren
CCAnimation doesn’t support this out of the box. Since we’re talking about just two frames I’d find it easier to just animate it straight in code, something like this (pseudo code):
This has the added benefit of not creating and releasing actions all the time.
You could also try using a CCAnimate action and keep changing its delay property whenever a frame changed. But I’m not sure if that’ll work correctly.
Lastly you could subclass CCAnimate to add an array of delays, one per frame, and customize the update method so that it’ll take the delay from the delays array rather than using a fixed delay.