本文整理汇总了C++中ParticleSystemQuad::setBlendAdditive方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystemQuad::setBlendAdditive方法的具体用法?C++ ParticleSystemQuad::setBlendAdditive怎么用?C++ ParticleSystemQuad::setBlendAdditive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSystemQuad
的用法示例。
在下文中一共展示了ParticleSystemQuad::setBlendAdditive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testCollin
//碰撞检测
void StartGame::testCollin(float dt){
auto visibleSize=Director::getInstance()->getWinSize();
__Array *tempItemArray=__Array::create();
tempItemArray->retain();
Item *item;
for (int i=0; i<itemArray->count(); i++) {
item=(Item*)itemArray->getObjectAtIndex(i);
if (Tools::isCollision(hook, item)&&!hook->hookAction&&!item->itemAction) {
hook->stopAllActions();
miner->MinerAction();
tempItemArray->addObject(item);
hook->hookAction = true;
item->itemAction=true;
if (toggle->getSelectedIndex()==1) {
dt=0.5;
}else{
dt=2.0;
}
auto move=MoveTo::create(dt, Vec2(visibleSize.width/2-5,visibleSize.height/2-20));
auto call=CallFunc::create(CC_CALLBACK_0(StartGame::move, this));
auto sequence=Sequence::create(move,call, NULL);
hook->runAction(sequence);
if (item->itemAction) {
item->setRotation(hook->getRotation());
item->setAnchorPoint(Point(0.5, 1));
hook->setAnchorPoint(Point(0.5, 0.7));
item->setPosition(hook->getPosition());
hook->setAnchorPoint(Point(0.5, 1));
}
if (item->_type==diamond||item->_type==secret) {
ParticleSystemQuad* quad = ParticleSystemQuad::create("Boom.plist");
quad->setBlendAdditive(true);
quad->setAutoRemoveOnFinish(true);
quad->setPosition(item->getPosition());
quad->setDuration(0.2);
this->addChild(quad);
}
auto move1=MoveTo::create(dt, Vec2(visibleSize.width/2-5,visibleSize.height/2-20));
auto call1=CallFuncN::create(CC_CALLBACK_1(StartGame::removeItem, this));
auto sequence1=Sequence::create(move1,call1, NULL);
item->runAction(sequence1);
}
}
itemArray->removeObjectsInArray(tempItemArray);
tempItemArray->release();
}
示例2: WarriorFactory
void Stage1::loadingsStep(float dt)
{
static int progress = 0;
//工廠模式
FactoryInterface *factory;
//FactoryInterface *enemyFactory = new EnemyFactory();
std::string arrFile[] =
{
"up.png",
"left.png",
"right.png"
};
Vec2 arrPos[] =
{
Vec2(48 + 96, 48 + 96),
Vec2(48, 48),
Vec2(48 + 96 * 2, 48),
Vec2(800, 48 + 96)
};
Weapon* weapon;
Vec2 map1Pos;
Vec2 treesPos;
ParticleSystemQuad* mSystem;
EventListenerTouchOneByOne *touchListener;
switch (progress)
{
case p10:
map = MapLayer::create();
bulletLayer = BulletLayer::create();
main = (MainFly*)MainFly::myCreate("main.png");
//利用工廠生產主角
factory = new WarriorFactory();
warrior = (Warrior*)factory->ctrateObject();
warrior->setName("Warrior");
weapon = (Weapon*)Weapon::create("weapon1.png");
warrior->setWeapon(weapon);
this->addChild(map, 2);
this->addChild(bulletLayer, 1);
map->addChild(weapon, 5);
map->addChild(warrior, 5);
this->addChild(main, 10);
//map->setPosition(Vec2(map->getPositionX()-960/2, map->getPositionY()-540/2));
break;
case p20:
for (int i = 0; i < 4; i++){
auto arr = Input::create("arr.png", Rect(i * 96, 0, 96, 96));
arr->setTag(i);
arr->setPosition(arrPos[i]);
arr->setControllee(warrior);
inputs.push_back(arr);
this->addChild(arr, 20);
}
warrior->setPosition(Vec2(oriX, oriY+200));
//warrior->setWorldPosition(Vec2(oriX, oriY));
//warrior->setEffect(_effect, "warrior_n.png");
for (int i = 2; i < 10+21; i++)
{
factory = new EnemyFactory();
auto skull = factory->ctrateObject();
skull->setPosition(Vec2(oriX*(i), oriY+400));
skull->setName("skull");
//skull->setEffect(_effect, "warrior_n.png");
map->addChild(skull, 5);
}
mainPos = Vec2(100, 100);
main->setPosition(mainPos);
break;
// ...
case p30:
map1 = Sprite::create("stage1Back.png");
map1Pos = Vec2(0 + map1->getContentSize().width / 2, 0 + map1->getContentSize().height / 10);
map1->setPosition(map1Pos);
this->addChild(map1, 0);
trees = Sprite::create("trees.png");
treesPos = Vec2(0 + trees->getContentSize().width / 2, 0 + trees->getContentSize().height - 200);
trees->setPosition(treesPos);
this->addChild(trees, 1);
mSystem = ParticleSystemQuad::create("test.plist");
mSystem->setTextureWithRect(TextureCache::sharedTextureCache()->addImage("8.png"), Rect(0, 0, 64, 64));
mSystem->setBlendAdditive(true);
mSystem->setPosition(ccp(0, 540));
this->addChild(mSystem, 50);
//.........这里部分代码省略.........
示例3: init
bool StartGame:: init(){
if (!Layer::init()) {
return false;
}
itemArray=__Array::create();
itemArray->retain();
int k=arc4random()%6+1;
std::string str= StringUtils::format("mineBG%d.png",k);
auto visibleSize=Director::getInstance()->getVisibleSize();
auto sprite=Sprite::create(str);
sprite->setPosition(visibleSize.width/2,visibleSize.height/2);
this->addChild(sprite);
//离子
ParticleSystemQuad* quad = ParticleSystemQuad::create("fengye.plist");
quad->setBlendAdditive(true);
quad->setAutoRemoveOnFinish(true);
quad->setPosition(Vec2(400, 300));
this->addChild(quad);
//黄金
char a[50];
sprintf(a, "%d",score[level-1]);
auto sprite1=Sprite::create("Gold.png");
sprite1->setPosition(visibleSize.width/2-200,visibleSize.height/2+130);
auto lable1=Label::createWithSystemFont(a, "fonts/Marker Felt.ttf ", 28);
lable1->setTextColor(Color4B::GREEN);
lable1->setPosition(visibleSize.width/2-150,visibleSize.height/2+130);
lable1->setTag(10);
this->addChild(lable1);
this->addChild(sprite1);
//钱
auto sprite2=Sprite::create("rmbImage.png");
sprite2->setPosition(visibleSize.width/2-200,visibleSize.height/2+90);
auto lable2=Label::createWithSystemFont("0", "fonts/Marker Felt.ttf ", 28);
lable2->setPosition(visibleSize.width/2-150,visibleSize.height/2+90);
lable2->setTag(20);
lable2->setTextColor(Color4B::RED);
this->addChild(lable2);
this->addChild(sprite2);
//矿工
auto sprite3=Sprite::create("miner_0707.png");
sprite3->setPosition(visibleSize.width/2+180,visibleSize.height/2+130);
char c[50];
sprintf(c, "%d",level);
auto lable3=Label::createWithSystemFont(c, "fonts/Marker Felt.ttf ", 28);
lable3->setPosition(visibleSize.width/2+220,visibleSize.height/2+130);
lable3->setTag(30);
lable3->setTextColor(Color4B::GREEN);
this->addChild(lable3);
this->addChild(sprite3);
char d[50];
sprintf(d, "%d",totalTime[level-1]);
auto sprite4=Sprite::create("clockPlate.png");
sprite4->setTag(4);
sprite4->setPosition(visibleSize.width/2+180,visibleSize.height/2+90);
auto lable4=Label::createWithSystemFont(d, "fonts/Marker Felt.ttf ", 28);
lable4->setPosition(visibleSize.width/2+220,visibleSize.height/2+90);
lable4->setTag(40);
lable4->setTextColor(Color4B::GREEN);
this->addChild(lable4);
this->addChild(sprite4);
auto item=MenuItemImage::create("qianglishui.png", "qianglishui.png");
auto item1=MenuItemImage::create("qianglishui.png", "qianglishui.png");
toggle=MenuItemToggle::create();
toggle->addSubItem(item);
toggle->addSubItem(item1);
toggle->setScale(0.5);
toggle->setSelectedIndex(0);
toggle->setCallback([this](Ref*){
//减少PowerWater数量
auto lable=(Label*)this->getChildByTag(50);
int num= atoi(lable->getString().c_str());
if (num!=0){
Water--;
miner->setScale(1.5);
//this->schedule(schedule_selector(StartGame::changeSelect),8);
this->schedule(CC_CALLBACK_1(StartGame::changeSelect,this), 8, "changeSelect");
lable->setString(StringUtils::format("%d",Water));
this->testCollin(1.0);
}else if(num==0){
toggle->setSelectedIndex(0);
log("%d",toggle->getSelectedIndex());
}
});
menu=Menu::create(toggle, NULL);
menu->setPosition(Vec2(visibleSize.width/2+180, visibleSize.height/2+50));
std::string str1= StringUtils::format("%d",Water);
lable5=Label::createWithSystemFont(str1,"fonts/Marker Felt.ttf", 28);
lable5->setPosition(Vec2(visibleSize.width/2+220, visibleSize.height/2+50));
lable5->setTag(50);
lable5->setTextColor(Color4B::GREEN);
this->addChild(lable5);
//.........这里部分代码省略.........