粒子系统

/*加载plist文件
	方法一:
	auto* m_emitter1 = ParticleSystemQuad::create("test.plist");
	scene->addChild(m_emitter1, 2);
	//方法二:
	/*ParticleSystem* m_emitter1 = ParticleSystemQuad::create("snow.plist");
	m_emitter1->retain();
	ParticleBatchNode *batch = ParticleBatchNode::createWithTexture(m_emitter1->getTexture());
	batch->addChild(m_emitter1);
	scene->addChild(batch, 2);
	m_emitter1->release();*/

	/*ParticleExplosion, ParticleFire, ParticleFireworks, ParticleFlower, ParticleGalaxy, ParticleMeteor, ParticleRain
	ParticleSmoke, ParticleSnow, ParticleSpiral, ParticleSun 继承.*/
	/*auto pParticle = ParticleExplosion::create();
	scene->addChild(pParticle, 2);
	//更改一些参数
	auto pos = pParticle->getPosition();//获得位置
	pParticle->setPosition(Vec2(pos.x, pos.y + 110));//更改位置
	pParticle->setLife(3);//改变生存时间
	pParticle->setLifeVar(1);
	pParticle->setSpeed(120);//改变速度
	pParticle->setSpeedVar(30);
	Color4F Startcolor=pParticle->getStartColor();//改变开始颜色
	Startcolor.r = 1.0f;
	Startcolor.g = 0.9f;
	Startcolor.b = 0.9f;
	pParticle->setStartColor(Startcolor);
	Color4F startColorVar = pParticle->getStartColorVar();//改变开始颜色变化
	startColorVar.b = 0.1f;
	pParticle->setStartColorVar(startColorVar);
	pParticle->setEmissionRate(5000);//改变发射数量*/
	

你可能感兴趣的:(粒子系统)