//移动
ccBezierConfig bezier;
bezier.controlPoint_1 = Point(100, 0);
bezier.controlPoint_2 = Point(200, 250);
bezier.endPosition = Point(300, 50);
BezierBy *bezierTo = BezierBy::create(4.0f, bezier);//BezierTo是坐标点,BezierBy是向x,y移动多少距离。
sprite -> runAction(bezierTo);
//重复动作
//创建一个jumpBy动作对象
JumpBy *jump = JumpBy::create(3.0f, Vec2(50, 1), 100, 1);
//以jump为参数,创建一个永久性的重复动作
RepeatForever *repeatForeverActiong = RepeatForever::create(jump);
//以jump为参数,创建一个指定重复次数的动作
// Repeat *repeatActiong = Repeat::create(jump, 3);
sprite -> runAction(repeatForeverActiong);
//组合动作,动作一起播放。只需要把Spawn改成Sequence,动作就是一个接一个播放了。
//创建一个jumpBy动作对象
JumpBy *jump = JumpBy::create(3.0f, Vec2(50, 1), 100, 1);
//以jump为参数,创建一个永久性的重复动作
RepeatForever *repeatForeverActiong = RepeatForever::create(jump);
//以jump为参数,创建一个指定重复次数的动作
// Repeat *repeatActiong = Repeat::create(jump, 3);
// sprite -> runAction(repeatForeverActiong);
// add the sprite as a child to this layer
//创建一个移动动作对象
MoveBy *moveBy = MoveBy::create(2.2f, Vec2(40, 20));
//创建一个旋转动作对象
RotateBy *rotateBy = RotateBy::create(2.5f, 20, 10);
//创建组合动作对象,将所有动作连起来
Action *actions = Spawn::create(repeatForeverActiong, moveBy, rotateBy, jump, NULL);
sprite -> runAction(actions);
//
网友评论