CCAnimation - how to know the frame being shown?

When using a CCAnimation, where the animation will be using CCRepeatForever with its action, how can I determine at any given time which specific frame the animation is on.

The reason is because I will need to know where to place effects for the animation. I know the coordinates of where the effects should be placed for each individual frame, so somehow I need to know which frame the animation is on (and then how to translate the above mentioned coordinates into proper placement of the effect).

You can keep a handle of the Animate action. It has a method getCurrentFrameIndex() that may serve as part of your solution. You can also look into listening for the custom event AnimationFrameDisplayedNotification that should be called every frame and inspect the userInfo property of the event to determine the current frame info.

Another option is to create a Sequence that you wrap in a repeat forever and run alongside the animation. This is likely less precise and may even get out of sync, so I wouldn’t recommend it.

Another option would be to avoid using the action system and just schedule an update method where you track the time/frame and setDisplayFrame directly and then use your own frame index state information to handle effects.