Using Spritebuilder, I have chained timelines to themselves to create a loop (eg- for walking), but in some cases I would like to use Timelines that are not chained, and loop them programatically. I believe I may be able to use CCActionSequence to do this but have not been able to find an example. Can anyone provide an example please?
Loop an animation programatically in Cocos2d, like chaining the animation to itself in Spritebuilder
200 views Asked by Gene Myers At
1
Here's a late answer (you've probably found some kind of solution, but I'm posting anyway, for future reference): To my knowledge there isn't really any exposed way of achieving what you want to do in the current version of Cocos2d (v.3.4). And at the moment it doesn't look like this is going to change in v.4.0 (I'm making this assumption based on the current state of the develop branch on Github, but this can of course change).
That said, if you are willing to accept a little bit of hacking, I've created a category on CCAnimationManager that is exposing the
CCBSequence
s (i.e. the timelines) created in Spritebuilder, thus making it possible to change which timelines should be chained together in code. When using this category you could do something like this: