How do I rotate a sprite with ccbezierTo in cocos2d-x?

Posted by user1609578 on Game Development See other posts from Game Development or by user1609578
Published on 2014-06-04T10:12:53Z Indexed on 2014/06/04 15:46 UTC
Read the original article Hit count: 190

Filed under:
|
|

In cocos2d-x, I move a sprite with ccbezierTo like this:

// use for ccbezierTo
bezier.controlPoint_1 = ccp(m_fish->getPositionX() + 200, visibleSize.height/2 + 300);
bezier.controlPoint_2 = ccp(m_fish->getPositionX() + 400, visibleSize.height/2 - 300);
bezier.endPosition = ccp(m_fish->getPositionX() + 600,visibleSize.height/2);

bezier1.controlPoint_1 = ccp(m_fish->getPositionX() + 800, visibleSize.height/2 + 300);
bezier1.controlPoint_2 = ccp(m_fish->getPositionX() + 1000, visibleSize.height/2 - 300);
bezier1.endPosition = ccp(m_fish->getPositionX() + 1200,visibleSize.height/2);


bezierForward = CCBezierTo::create(6, bezier);
nextBezier = CCBezierTo::create (6,bezier1);

m_fish->runAction(CCSequence::create( bezierForward, nextBezier, NULL));

How can I make my sprite rotate while moving it with CCBezierTo?

© Game Development or respective owner

Related posts about cocos2d

Related posts about cocos2d-x