- //首先载入贴图集
- CCSpriteBatchNode*spriteBatch=CCSpriteBatchNode::batchNodeWithFile("snake.png");
- this->addChild(spriteBatch);
- CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("snake.plist");
- //生成Sprite
- CCSprite*headSprite=CCSprite::spriteWithSpriteFrameName("headup.png");
- //需要更换图片时
- CCSpriteFrame*frame=CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("headleft.png");
- headSprite->setDisplayFrame(frame);
转载http://blog.csdn.net/weyson/article/details/7746492