I am having some problem with removing animation from the scene:
Following is my code:
CCSprite m_pSprite3 ; //Global Variable
CCSpriteFrameCache spriteCache = CCSpriteFrameCache::sharedSpriteFrameCache;
m_pSprite3 = CCSprite::createWithSpriteFrameName;
CCAnimationCachecache = CCAnimationCache::sharedAnimationCache(); // “caches” are always singletons in cocos2d
CCAnimation *animation = cache~~>animationByName(“carrotAnim”); // I apologize for this method name, it should be getAnimationByName(…) in future versions
CCAnimate animate = CCAnimate::create; // Don’t confused between CCAnimation and CCAnimate
CCFiniteTimeAction action = CCSequence::create(animate,CCCallFuncO::create(this, callfuncO_selector(GamePlay::carrotBurstAnimationCallback),NULL),NULL);
I have generated animation using spritehelper.
The animation is happening when a user hits a carrot. Every thing is working fine till user is hitting it slowly. But when the user is hitting it fast the previous animation does not get removed from the scene.
I guess it is happening because, since the next animation is staring before the previous animation gets complete, the previous animation does not get to the callback function…
do we have any other alternative to do this….???