How to differentiate among CCActionInterval, CCAction and CCFiniteTimeAction

Hi,
I’m confuse with CCActionInterval, CCAction and CCFiniteTimeAction.

I have a sample code below,

CCActionInterval* rotate = CCRotateBy::create(0.5f , –90);
CCAction* repeatRotate = CCRepeatForever::create( rotate );
CCFiniteTimeAction* sequence = CCSequence::create(
CCMoveTo::create(_meteorSpeed, ccp(meteor_target_x, _screenSize.height * 0.15f)),
CCCallFuncN::create(this, callfuncN_selector(GameLayer::fallingObjectDone)),
NULL);

But, I don’t know how to use and differentiate among them.
Normally, I just use CCAction when I code in Cocos2d.

Thank you.

1 Like

Hi,
I will try to explain.
CCAction is the base class for all CCAction objects. So, all the other action objects inherit from it.
CCFiniteTimeAction inherits from CCAction and it’s the base class for all actions that have a finite time duration, for example moving from one point to another (CCMoveTo) it’s a finite action, because it will finish at some point of the time. But for being more specific, there can be 2 types of finite actions, those which start and end immediately and those which start and end after some period of time, that’s why there are 2 classes inheriting from CCFiniteTimeAction:

CCActionInterval - An interval action is an action that takes place within a certain period of time. It has an start time, and a finish time. The finish time is the parameter duration plus the start time.
CCActionInstant - Instant actions are immediate actions. They don’t have a duration.

I hope you understood the difference. So now it’s up to you to decide which one to use in which case :wink:

Regards,
Artavazd