I was trying to translate it from objective-C (Book Learning Cocos2D - Chapter 2), but it didn’t work.
The code didn’t crash, but the animation didn’t work.
CCAnimation* animation = CCAnimation::animation();
CCAnimate animate = CCAnimate::actionWithAnimation;
CCActionact = CCRepeatForever::actionWithAction;
So, I added some code in CCAnimation.cpp and CCAnimation.h:
bool init(float delay);
static CCAnimation* animation(float delay);
bool CCAnimation::init(float delay)
return initWithFrames(NULL, delay);
CCAnimation* CCAnimation::animation(float delay)
CCAnimation **pAnimation = new CCAnimation;
In my code, I changed
CCAnimation** animation = CCAnimation::animation();
CCAnimation* animation = CCAnimation::animation(0.3f);
Then… everything is working fine.
Was I doing anything wrong?
I hope it could help us.
Should we put it in Cocos2D code?