Note that there are some explanatory texts on larger screens.

plurals
  1. POSpriteAnimation in COCOS2DX with plist
    text
    copied!<p>hello i am using this code for animating a sprite using cocos2dx. </p> <pre><code>CCSpriteFrameCache::sharedSpriteFrameCache()-&gt;addSpriteFramesWithFile("suhas.plist"); CCLog("#########################"); CCSpriteBatchNode *spriteSheet = CCSpriteBatchNode::batchNodeWithFile("suhas.PNG"); CCLog("*********************************"); this-&gt;addChild(spriteSheet); CCLog("*********************************"); CCArray *bearArray = new CCArray(); for(int i = 1; i &lt;= 8; i++) { CCLog("*********************************"); char name[32] = {0}; sprintf(name, "bear%d.png",i); bearArray-&gt;addObject(CCSpriteFrameCache::sharedSpriteFrameCache()-&gt;spriteFrameByName(name)); } CCAnimation *walkAnim = CCAnimation::animationWithSpriteFrames(bearArray, 0.1f); CCSize size = CCDirector::sharedDirector()-&gt;getWinSize(); CCSprite *bear = CCSprite::spriteWithSpriteFrameName("bear1.png"); bear-&gt;setPosition(ccp(size.width/2, size.height/2)); CCAction *walkAction = CCRepeatForever::actionWithAction(CCAnimate::actionWithAnimation(walkAnim)); bear-&gt;runAction(walkAction); spriteSheet-&gt;addChild(bear); return true; </code></pre> <p>But my code in crashing. and giving error </p> <pre><code>cocos2d: CCSpriteFrameCache: Trying to use file D:\cocos2dnew\SPRITEAnimDemo\Resources\suhas.png as texture First-chance exception at 0x00000000 in SPRITEAnimDemo.win32.exe: 0xC0000005: Access violation. Unhandled exception at 0x00000000 in SPRITEAnimDemo.win32.exe: 0xC0000005: Access violation. The program '[1012] SPRITEAnimDemo.win32.exe: Native' has exited with code -1073741819 (0xc0000005). </code></pre> <p>I tried on google for solving this problem. Please help me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload