Difference between BezierBy and BezierTo in Cocos2d?

I want to know the difference between BezierBy and BezierTo. What happens in the code below if we say this is a script

     CCBezierConfig bezier = new CCBezierConfig();


     // Bezier curve  
     bezier.controlPoint_1 = CGPoint.make(1002.0f,475.0f);
     bezier.controlPoint_2 = CGPoint.make(454.0f, 281.0f);
     bezier.endPosition = CGPoint.make(-20.0f,490.0f);

     CCBezierBy by = CCBezierBy.action(100, bezier);
     CCBezierTo to = CCBezierTo.action(2, bezier);

     CCCallFuncN actionMoveDone = CCCallFuncN.action(this,"spriteMoveFinished");
     CCSequence actions = CCSequence.actions(by, actionMoveDone);

     obstacle1.runAction(actions);

Also have the same problems in understanding moveTo and moveBy

Please help me with the concepts.

+3
source share
1 answer

CCMoveTo moves your node TO position. CCMoveBy moves your node for sone pixels. All of these actions are the same. Example:

CCNode *a = [[CCNode alloc] init];
[a setPosition:CGPointMake(100, 100)]; //our node starts at point (100, 100)

Now, if you move it TO CGPointMake (200,200), its positions will be (200, 200). But if you move it from (100, 100) BY CGPointMake (200 200), it will be (300, 300).

+5
source

All Articles