3

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 !!!

6 Answers 6

7

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; 
Sign up to request clarification or add additional context in comments.

Comments

4
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; 

10 Comments

@Shinu: I tried this as well but there is no change in the result. Here is my code: CCParticleExplosion *particle = [[CCParticleExplosion alloc] initWithTotalParticles:5]; [particle setTexture:[[CCTextureCache sharedTextureCache] addImage:@"particle1.png"]]; particle.position = ccp(point.x, point.y); [particle setGravity:ccp(0, -300)]; particle.blendAdditive = NO; particle.autoRemoveOnFinish = YES; [self addChild:particle]; [particle release];
But the fact is that the code I posted worked fine for me! Did you work on that? Tried clean up? Tried deleting the previous application from the simulator/device?
yes I did all the things u told, particles are still in random colors. Is there another way? or any mistake on my side?
@iPhone monster->Ok! then try this.. give Red, Green , Blue & Alpha values of the particles to the same value! Here Alpha is the opacity. For eg: for getting white color to the particles set startColor.r,startColor.g, startColor.b, & startColor.a = 1.0f. Also set 1.0f to startColorVar, endColor, endColorVar for r,g,b & a. OK? This will give you white particles only. Try with different values. OK??
@Shinu: first thnx for your effort and as I told you for your first answer I have tried giving valuer to sartColor,startColorVar etc. but that is not working yar, and your second answer I tried but that too is not showing any change on the screen... I am not able to find where is the issue.
|
1

@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??

6 Comments

@shinu:Thanx for your response and I am using only built in particle effects of ParticleSystem. But what I actually want is that I don't want any color for my particles, I just want to display the images as I am setting for the particles to be shown as such. I have already used what you are saying but that only sets the color for the particles, I don't want any color but want to show only image as such, please tell me if it is possible.
in that case , then set blendAddictive to YES.
ie, self.blendAddictive=YES; or yourEmitter.blendAddictive=YES; where 'yourEmitter' is your particle system object. OK?
@Shinu: I applied your suggestion in my code, on the particleSystem object and this is still not working as I want. Hope you clearly understand what I want to do. I want only particle image not the colors (i.e shown as a default effects).
Oh!! Sorry! my mistake! set blendAddictive to NO. Try it out. if not working then please do post your code so I can precisely comment. OK?
|
1

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.

enter image description here

Particle Designer supports all iOS devices allowing you to target the widest audience.

Comments

0

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; 

1 Comment

you can't do it in this way, it shows error as LValue required.
0

i recommend particle designer to create particles, look this tutorial http://www.ferbass.com/2011/05/03/cocos2d-using-particles/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.