When I want to init animation, I use this code:
CCTexture2D *texture = CCTextureCache::sharedTextureCache~~>addImage;
CCSpriteFrame frame0 = CCSpriteFrame::frameWithTexture);
CCSpriteFrameframe1 = CCSpriteFrame::frameWithTexture);
CCSpriteFrame frame2 = CCSpriteFrame::frameWithTexture);
CCSpriteFrameframe3 = CCSpriteFrame::frameWithTexture);
CCSpriteFrame frame4 = CCSpriteFrame::frameWithTexture);
CCSpriteFrameframe5 = CCSpriteFrame::frameWithTexture);
CCSpriteFrame frame6 = CCSpriteFrame::frameWithTexture);
CCSpriteFrameframe7 = CCSpriteFrame::frameWithTexture);
CCSprite* spZhadananim = CCSprite::spriteWithSpriteFrame;
spZhadananim~~>setPosition);
addChild;
CCMutableArray<CCSpriteFrame>*animZhadanWaitFrames = new CCMutableArray<CCSpriteFrame>(4);
animZhadanWaitFrames~~>addObject;
animZhadanWaitFrames~~>addObject(frame5);
animZhadanWaitFrames~~>addObject;
animZhadanWaitFrames~~>addObject(frame7);
CCMutableArray<CCSpriteFrame*> animZhadanExciteFrames = new CCMutableArray<CCSpriteFrame>;
animZhadanExciteFrames~~>addObject;
animZhadanExciteFrames~~>addObject;
animZhadanExciteFrames~~>addObject;
animZhadanExciteFrames~~>addObject;
CCAnimation*animationWait = CCAnimation::animationWithFrames(animZhadanWaitFrames, 0.1f);
CCAnimate animateWait = CCAnimate::actionWithAnimation;
CCAnimationanimationExcit = CCAnimation::animationWithFrames(animZhadanExciteFrames, 0.2f);
CCAnimate animateExcit = CCAnimate::actionWithAnimation;
CCCallFuncanimOverCallBack = CCCallFunc::actionWithTarget(this, callfunc_selector(SingleFightLayer::animBombsOverCallBack));
spZhadananim~~>runAction,
//CCDelayTime::actionWithDuration,
CCRepeat::actionWithAction,
animOverCallBack,
NULL
));
animZhadanWaitFrames~~>release();
animZhadanExciteFrames->release();
return true;
But there is a problem, I can compile it, but when I run it, I meet an exception
CCAnimation *animationWait = CCAnimation::animationWithFrames(animZhadanWaitFrames, 0.1f);
Can’t init the animation
beatme.win32.exe 中的 0x5a138040 处有未经处理的异常: 0xC0000005: 写入位置 0xfdfdfe09 时发生访问冲突
Who can Help me?? Thank you!