CCFiniteTimeAction with infinite time

CCFiniteTimeAction with infinite time
0.0 0


I want to use

The reference say:

Detailed Description CCFiniteTimeAction cocos2d-x Reference
Base class actions that do have a finite time duration.
Possible actions:
An action with a duration of 0 seconds
An action with a duration of 35.5 seconds
Infinite time actions are valid

I will put:

CCFiniteTimeAction *myInfAction = CCFiniteTimeAction();

And I will edit virtual void update to make my own calculation.

But, How I add a infinite time duration without use a big number like 999999?


I don’t think that there is a CCInfiniteTimeAction class, maybe you are referring to CCFiniteTimeAction?
Anyway, if you want to repeat an action forever then use CCRepeatForever.


I Misspelled :smiley:

I want to use this function to update a value. To do this, I use a function which evaluate getElapsed() because virtual void(float time) time values < (0, 1) < . If I use RepeatForever, I get always getElapsed() = 0.


If you can elaborate use case in more details probably I can give some hint to you :wink:


In my game, I have a function of the difficult expressed using a int.


int A = 5;
int B = 12;
int currentDifficult = A · cos(wt) + B · t;

So, the difficult at start is: A

But increased with the time. t = this->getElapsed();

I don’t know how much is during the actions, because it could take forever (The time the player is alive).

Actually, I solve the problem calling manually update this function, but I would like implemented like an Action associated to the level without use scheluders.