Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("suhas.plist");
  2. CCLog("#########################");
  3. CCSpriteBatchNode *spriteSheet = CCSpriteBatchNode::batchNodeWithFile("suhas.PNG");
  4. CCLog("*********************************");
  5. this->addChild(spriteSheet);
  6. CCLog("*********************************");
  7. CCArray *bearArray = new CCArray();
  8. for(int i = 1; i <= 8; i++)
  9. {
  10. CCLog("*********************************");
  11. char name[32] = {0};
  12. sprintf(name, "bear%d.png",i);
  13. bearArray->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name));
  14. }
  15. CCAnimation *walkAnim = CCAnimation::animationWithSpriteFrames(bearArray, 0.1f);
  16. CCSize size = CCDirector::sharedDirector()->getWinSize();
  17. CCSprite *bear = CCSprite::spriteWithSpriteFrameName("bear1.png");
  18. bear->setPosition(ccp(size.width/2, size.height/2));
  19. CCAction *walkAction = CCRepeatForever::actionWithAction(CCAnimate::actionWithAnimation(walkAnim));
  20. bear->runAction(walkAction);
  21. spriteSheet->addChild(bear);
  22. return true;
  23.  
  24. cocos2d: CCSpriteFrameCache: Trying to use file D:cocos2dnewSPRITEAnimDemoResourcessuhas.png as texture
  25. First-chance exception at 0x00000000 in SPRITEAnimDemo.win32.exe: 0xC0000005: Access violation.
  26. Unhandled exception at 0x00000000 in SPRITEAnimDemo.win32.exe: 0xC0000005: Access violation.
  27. The program '[1012] SPRITEAnimDemo.win32.exe: Native' has exited with code -1073741819 (0xc0000005).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement