有没有人知道cocos2d中的粒子引擎教程?
答案 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!