I am trying to add multiple SkeletonAnimations, but run into the following problem:
When adding the CCSkeletonAnimation node to the scene it draws and runs just fine.
But when I try to add the same node again, the first node disappears and only the second node is drawn and animated.
Here the function that creates the animations:
void MyLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
CCTouch* pTouch = static_cast<CCTouch*>(pTouches->anyObject());
CCSkeletonAnimation* node = CCSkeletonAnimation::createWithFile("unit.json", "unit.atlas");
node->setAnimation(0, "walking", true);
node->setPosition(pTouch->getLocation());
addChild(node );
}
Adding multiple nodes in the same function works correctly, however, the above problem occurs when calling the function again.
I suspect that some of the data is shared internally, but what do I need to set in order to duplicate the node?