Elapsed time in custom action

Elapsed time in custom action
0.0 0


Hi All!

I’m writing my custom action by subclassing CCActionInterval and I need to know the current elapsed time.

To know the elapsed time I should be able to use CCActionInterval::getElapsed() but once I wrap my custom action in an ease action then getElapsed() always return zero. Seems that the step method of my custom action is no more called.

What would be the best approach to get the elapsed time in that case?

Thank you!

[BUG] Actions within a Sequence don't update elapsed time?

Could you show us your code?


Attached an example class which illustrate the issue.

When running the sole action I get the correct elapsed time:

Cocos2d: delta:0.999843 elapsed:1.999685
Cocos2d: delta:0.999843 elapsed:1.999685
Cocos2d: delta:1.000000 elapsed:2.016310

When running through an ease action then the elapse time is no more updated:
runAction(CCEaseOut::create(MoveAction::create(2.f), .3f));

Cocos2d: delta:0.989647 elapsed:0.000000
Cocos2d: delta:0.989647 elapsed:0.000000
Cocos2d: delta:1.000000 elapsed:0.000000