I have an arrow that I rotate with touch. I was wondering if it was possible to rotate the arrow on a curved line? I\'ve done some research and I think it is called a bezier
Never tried but i think it's possible, basically what you want to do is when the user touch the screen the arrow move to the touch location on a curve line and the arrow rotate on the curve ?
first you need to make the arrow rotate and then perform the bezier action
//on touch
CGSize s = [[CCDirector sharedDirector] winSize];
//rotate action we make the arrow rotate forever
id actionBy = [CCRotateBy actionWithDuration:2 angle: 360];
[arrow runAction: [CCRepeatForever actionWithAction:actionBy]];
//bezier action
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];
id action = [CCCallFunc actionWithTarget:self selector:@selector(endAction)];
[arrow runAction:[CCSequence actions:bezierForward, action]];
//write a method endAction
[arrow stopAllActions];