替换精灵的显示图片

  1. CCSpriteBatchNode *spriteBatch=CCSpriteBatchNode::batchNodeWithFile("********.png");  
  2. this->addChild(spriteBatch);  
  3. //加载plist
  4. CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("myconfig.plist");  
  5. // 生成Sprite   
  6. CCSprite *headSprite=CCSprite::spriteWithSpriteFrameName("aaa.png");  
  7. //需要更换图片时   
  8. CCSpriteFrame *frame=CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bbb.png");  
  9. headSprite->setDisplayFrame(frame);