shuai
#1
Currently i use
sprite->setTexture()
to do this.
But if i want the sprite to finish a sequence of actions which contains replacing the image, eg:
sprite->runAction(CCSequence::create(ccMoveTo, replacingImage, ccScaleTo, NULL));
I did not find a corresponding action.
Or should i use the call back func?
You can create own subclass of CCInstantAction. Just look at any action inside cocos2d-x sources.
Or you could run simply something like this.
CCArray *animFrames = CCArray::createWithCapacity(6);
animFrames->addObject(pSpriteCache->spriteFrameByName("player-0-1.png"));
m_pAnimationStandLeft = CCAnimation::createWithSpriteFrames(animFrames,
1.0F / 9.0F);
m_pAnimationStandLeft->retain();
runAction(CCAnimate::create(pAnimation));