开发者

particle engine in cocos2d [closed]

开发者 https://www.devze.com 2023-02-21 01:44 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_C百科

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 question

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

Seriously though, you should use Google and the documentation. Don't be lazy.

0

精彩评论

暂无评论...
验证码 换一张
取 消