Cocos2d: Move a Sprite along a path/bezier?
I need to move a sprite from one CGPoint to another using Cocos2d for the Iphone. The problem is that the 开发者_运维百科animation should be along a bezier.
Basically I would use this :
id move = [CCMoveTo actionWithDuration:.5f position:ccp(100,200)];
[sprite runAction:move];
Now how can I do this in a non linear path ?
Try this
ccBezierConfig bezier;
bezier.controlPoint_1 = ccp(0, s.height/2);
bezier.controlPoint_2 = ccp(300, -s.height/2);
bezier.endPosition = ccp(300,100);
id bezierForward = [CCBezierBy actionWithDuration:3 bezier:bezier];
Well, actually I was once again too fast seeking for help.
Found the solution, there is a method : CCBezierTo
精彩评论