cocos2dx之CCFlipX,CCFlipY

CCFlipX,CCFlipY

这两个类都是继承了CCActionInstance,分别是围绕X,Y轴进行旋转,例子代码:

 CCSprite *sprite1 = CCSprite::create();
        sprite1->initWithTexture(texture2d);
        sprite1->setAnchorPoint(ccp(0.5f, 0.5f));
        sprite1->setPosition(ccp(size.width / 2.0f, size.height / 2.0f));
        pient->addChild(sprite1, 1);

        CCFiniteTimeAction *moveTo = CCMoveTo::create(5, ccp(-50, 50));
        CCFiniteTimeAction *action1 = dynamic_cast<CCFiniteTimeAction *>(moveTo->copy());
        CCFiniteTimeAction *place = CCPlace::create(ccp(size.width / 2.0f, size.height / 2.0f));
        CCFiniteTimeAction *flipX = CCFlipX::create(true);
        CCFiniteTimeAction *flipY = CCFlipY::create(true);
        CCFiniteTimeAction *sequence = CCSequence::create(/*action1, place, */flipX, flipX->reverse(), flipY, flipY->reverse(), NULL);
        sprite1->runAction(sequence);


你可能感兴趣的:(cocos2dx之CCFlipX,CCFlipY)