Creating a CCRepeatForever with return value from CCSequence::actions

Creating a CCRepeatForever with return value from CCSequence::actions
0.0 0



I would like to use a CCSequence to create a CCRepeatForever action, using the following:

CCRepeatForever::actionWithAction(CCSequence::actions(some, actions, nil));

However, I get the following compile error:

cocos2d::CCRepeatForever::actionWithAction’ : cannot convert parameter 1 from ‘cocos2d::CCFiniteTimeAction ’ to ’cocos2d::CCActionInterval

Is there any workaround for this? Obviously CCFiniteTimeAction and CCActionInterval are both actions, and both implement some of the needed API used inside of CCRepeatForever, such as getDuration() and reverse(). Perhaps an intermediary class is in order?

It would appear that this is possible in cocos2d-iphone, no doubt using some of the crazy objective-c magic…



@warning This action can’t be Sequenceable because it is not an IntervalAction

It is the comment of CCRepeatForever.


Although, CCSequence::actions returns CCFiniteTimeAction**, if you pass more than one parameter, you will get CCSequence, otherwise, if it is only one parameter, you will have the same action.
So what it means is that you can simply cast to CCSequence** and it will work well.

CCRepeatForever::actionWithAction( (CCSequence*)CCSequence::actions( action1, action2, NULL ) );