If you need to perform few actions one by one over the same object you can use the Sequence class.
For example the blue ship in our previous demo appears to be facing north. If we want it to fly to the right we should first rotate it by 90 degrees and then perform the move.
In order to do this we create RotateTo and MoveTo actions and then join them into a sequence:
RotateBy* rotateBy = RotateBy::create(2, 90);
MoveBy* moveBy = MoveBy::create(4, Vec2(160,0));
Sequence* seq = Sequence::create(rotateBy, moveBy, nullptr);
blueShip->runAction(seq);
The Sequence's constructor method can receive any number of pointers to various actions, but the last pointer should be always nullptr (gcc will give you a special kind of warning if it’s not). The sequence objects will do all the actions and result will look like this:
Also, the cocos2d-x has few special actions that will be useful when building a sequences: