cocos2d-x【小菜在学习】如何增加光晕效果以及CCSpriteFrameCache使用

//今天小菜又来做做笔记啦,希望大家能共同学习,共同进步哈
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("bullet.plist","bullet.png");
//表示将bullet.plist文件,以及图片加进缓存中 
CCSpriteBatchNode *m_Batchnode=CCSpriteBatchNode::create("bullet.png");ccBlendFunc cb={GL_SRC_ALPHA,GL_ONE};
//这个是光晕效果的参数
m_Batchnode->setBlendFunc(cb);
//将光晕效果加入到
CCSpriteBatchNode里this->addChild(m_Batchnode);
//最后实例化一个
CCSpriteCCSprite *bullet=CCSprite::createWithSpriteFrameName("W1.png");
//缓存中取出W1.png图片,这个图片是在plist文件中所在的<key>标签里面的
bullet->setPosition(ccp(x,y));
m_Batchnode->addChild(bullet);
//记得不是用this->addChild而是用m_Batchnode->addChild(bullet);
//这样就能有光晕效果啦 主要是理解CCSpriteBatchNode

你可能感兴趣的:(cocos2d-x光晕效果)