views:

767

answers:

2

Hi

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 ?

Thx

+1  A: 

Well, actually I was once again too fast seeking for help.

Found the solution, there is a method : CCBezierTo

eemceebee
+2  A: 

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];
elementsense