方法:在3d動作後,刪除該精靈,創建一個新的精靈
.h-------------------- void newSprite(float dt);
.cpp----------------CCActionInterval *shaky=CCShaky3D::create(2, CCSizeMake(4,4),4, 0);
pSprite->runAction(CCSequence::create(shaky,shaky->reverse(),NULL));
this->addChild(pSprite, 0, 100);
this->schedule(schedule_selector(HelloWorld::newSprite),2);
void HelloWorld::newSprite(float dt){
this->removeChildByTag(100);
CCSprite *newSprite = CCSprite::create("HelloWorld.png");
this->addChild(newSprite,0);
newSprite->setPosition(ccp(visibleSize.width/2 , visibleSize.height/2 ));
this->unschedule(schedule_selector(HelloWorld::newSprite));
}
|