cocos2d中的粒子引擎

时间:2011-04-01 11:09:27

标签: iphone cocos2d-iphone

有没有人知道cocos2d中的粒子引擎教程?

1 个答案:

答案 0 :(得分:2)

在“.h”文件中

 CCParticleSun *sun;

在“.m”文件中

-(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];
    }
}

这将创造一个漂亮的小爆炸效果。你必须使用粒子图像: Particle I Created

Here is the image:

Particle http://dl.dropbox.com/u/21177870/exp-hd.png

有许多不同类型的颗粒: Particles Documentation That You Should Have Read Before Asking On This Website!

但严重的是,您应该使用Google和文档。不要偷懒。

相关问题