Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Particle System

I want show particle 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 !!!

like image 678
iOS Monster Avatar asked Dec 06 '25 16:12

iOS Monster


2 Answers

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;
like image 57
Ned Avatar answered Dec 08 '25 09:12

Ned


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;
like image 41
ShinuShajahan Avatar answered Dec 08 '25 07:12

ShinuShajahan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!