cocos2d-x 实现翻牌效果

翻牌的3D动画:

CCSprite* pSprite = CCSprite::spriteWithFile("HelloWorld.png");
pSprite->setPosition( ccp(size.width/2, size.height/2) );
 
pSprite->runAction( CCSequence::actions( CCOrbitCamera::actionWithDuration(1 , 1 , 0 , 0 , 90 , 0, 0),
        CCCallFuncN::actionWithTarget(this , callfuncN_selector(HelloWorld::objectReset) ) , 
CCOrbitCamera::actionWithDuration(1 , 1 , 0 , 90, 90 , 0, 0), NULL) );
this->addChild(pSprite, 0);
return true;
}
void HelloWorld::objectReset(CCNode* sender)
{
        CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage("HelloWorld1.png");
CCSprite *sprite = (CCSprite *)sender;
sprite -> setTexture(texture);
}

 

posted on 2013-04-14 10:24  jack_yan  阅读(572)  评论(0编辑  收藏  举报