Custom Particle System
I want show particle 开发者_JAVA技巧effect in my app, but problem is when I add particles on the view it shows particle image of different colors, I don't want any color effect on the particle images I am using. Please help me!!
THANX !!!
Thanks Calvin Fan! It work for me fine!! Here is my code:
CCParticleExplosion *drops = [[CCParticleExplosion alloc] initWithTotalParticles:3000];
drops.texture = [[CCTextureCache sharedTextureCache] addImage:@"p1-dust-l.png"];
drops.position = position;
drops.life =0.2;
drops.duration = 0.5;
drops.scale = 0.5;
drops.speed = 100;
ccColor4F startColor, startColorVar, endColor, endColorVar;
startColor.r = 1.0f;
startColor.g = 1.0f;
startColor.b = 1.0f;
startColor.a = 1.0f;
startColorVar.r = 0.0f;
startColorVar.g = 0.0f;
startColorVar.b = 0.0f;
startColorVar.a = 0.0f;
endColor.r = 1.0f;
endColor.g = 1.0f;
endColor.b = 1.0f;
endColor.a = 1.0f;
endColorVar.r = 0.0f;
endColorVar.g = 0.0f;
endColorVar.b = 0.0f;
endColorVar.a = 0.0f;
drops.startColor = startColor;
drops.startColorVar = startColorVar;
drops.endColor = endColor;
drops.endColorVar = endColorVar;
drops.autoRemoveOnFinish = YES;
CCParticleExplosion *myEmitter; myEmitter = [[CCParticleExplosion alloc] initWithTotalParticles:30]; //star.png is my particle image myEmitter.texture = [[CCTextureCache sharedTextureCache] addImage:@"star.png"]; myEmitter.position = ccp(250,s250); myEmitter.life =0.2; myEmitter.duration = 0.5; myEmitter.scale = 0.5; myEmitter.speed = 100; //For not showing color myEmitter.blendAdditive = NO; [self myEmitter z:50]; myEmitter.autoRemoveOnFinish = YES;
@iPhone Monster-> You can use startColor, startColorVar, endColor, endColorVar properties of your particle system. Try it out.
Are you using built in particle effects?? or one using Particle designer??
You can create custom particle using different type of image.
In cocos2d, some classes are available. Some softwares are also available. Here i am attaching one link http://particledesigner.71squared.com/. It will help you a lot. Create stunning visual effects for your latest game by customizing every aspect of your particle emitters.
You can access a large online library of royalty free emitters ranging from fire and explosions to waterfalls and and snow. After your emitter is complete, submit it to the online library to show off your work.
Particle Designer supports all iOS devices allowing you to target the widest audience.
Try:
startColor.r = 1.0f;
startColor.g = 1.0f;
startColor.b = 1.0f;
startColor.a = 1.0f;
startColorVar.r = 0.0f;
startColorVar.g = 0.0f;
startColorVar.b = 0.0f;
startColorVar.a = 0.0f;
endColor.r = 1.0f;
endColor.g = 1.0f;
endColor.b = 1.0f;
endColor.a = 1.0f;
endColorVar.r = 0.0f;
endColorVar.g = 0.0f;
endColorVar.b = 0.0f;
endColorVar.a = 0.0f;
self.blendAdditive = NO;
i recommend particle designer to create particles, look this tutorial http://www.ferbass.com/2011/05/03/cocos2d-using-particles/
精彩评论