Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionDoes anyone know the tutorial of a particle engine in cocos2d?
In your ".h" file:
CCParticleSun *sun;
In your ".m" file:
-(id) init
{
if( (self=[super init] ))
{
sun = [[CCParticleSun alloc] initWithTotalParticles:180];
sun.texture = [[CCTextureCache sharedTextureCache] addImage:@"yourparticle.png"];
sun.autoRemoveOnFinish = YES;
sun.speed = 30.0f;
sun.duration = 0.5f;
sun.position = ccp(240, 160);
sun.startSize = 5;
sun.endSize = 50;
sun.life = 0.6;
[self addChild:sun];
}
}
This will create a nice little explosion effect. You have to use a particle image: Particle I Created
Here is the image:
Particle http://dl.dropbox.com/u/21177870/exp-hd.png
There are many different types of particles: Particles Documentation That You Should Have Read Before Asking On This Website!
精彩评论