runAction on a CCSprite inherited object

runAction on a CCSprite inherited object
0.0 0


Hey all,
I was trying to create a default motion of a object of a class inherited from the CCSprite class.
But when i try to call the runAction inside the class definition, the function doesn’t work.
The application doesn’t crash, but the action is not performed.

class object : public CCSprite { ... ... public : void move(){ this->runAction(CCMoveTo::actionWithDuration(2.0f, ccp(0,0))); } }

Is it not supposed to run??


I think it should work, did you add the CCSprite as a child?


Previous post suggests us to make a new class with CCSprite object rather than inherit from it.

Maybe you can give it a try, and this is what I do in my code

ex :
class man{

CCSrpite* _sprite;


It worked… it needed scheduleUpdate() call in the constructor…

Thanks for the replies :slight_smile: