How can I create an Action like (MoveTo(x1,y1, x2,y2) => Restart on x1,y1 again and repeat it endless?
Vec2 p1 = Vec2(x1, y1); Vec2 p2 = Vec2(x2, y2); auto moveToStart = MoveTo::create(0.0f, p1); //0 - time = teleportation auto moveTo = MoveTo::create(1.0f, p2); //adjust your time auto sequence = Sequence::createWithTwoActions(moveToStart, moveTo); auto repeat = Repeat::create(sequence, -1); //infinite loop sprite->runAction(repeat);
Easy idea. Thanks works.
There is also Many more, Look up GitBook
it will show you how to add a pause, delay too.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.