• Runtimes
  • cocos2d-x removeChild()/addChild() bug?

  • Изменено
Related Discussions
...

Hi All,

In cocos2d-x if you remove (removeChild()) CCSkeletonAnimation from its parent and then re-add it to some parent (addChild()) then the animation stops running.

I've noticed that calling scheduleUpdate() after re-adding a CCSkeletonAnimation causes it to start running again. The problem is that you're not supposed to call scheduleUpdate() multiple times and the return value on isRunning() seems to be inconsistent (sometimes it's true even though it doesn't seem to be running).

Is this a bug or am I approach remove/add in the wrong way?

Thanks,
Chad

Hmm, I'm not sure how remove and scheduleUpdate interact. I guess this is more of a cocos2dx question, maybe ask over there?

Hi Nate,

I'm not sure what standard procedure is for something like this in cocos2d-x (I haven't used any animated cocos2d-x components other than CCSkeletonAnimation).

Anyway, I found a solution that works for now and I posted on their forum asking for a better solution if there is one. Here's the post (and solution): http://cocos2d-x.org/forums/6/topics/37694

Thanks