开发者

cocos2d - how to add a particle system to a scene

I can't find any documentation on how to a开发者_开发百科dd a particle system created with Particle Designer to a scene.

All the programming guide says is this:

id particleSystem = [CCParticleSystemQuad particleWithFile:@"MyParticle.plist"];

ok. then what? [self addChild:particleSystem]; ?

Also, there's this problem:

#import "cocos2d.h"
#import "CCParticleSystemQuad.h"
error: CCParticleSystemQuad.h: No such file or directory


You may want to try using a CCParticleSystem* pointer just to see if that works any differently for you. Here's a sample from one of the games I'm working on...

CCParticleSystem* particle_system = [CCParticleSystemQuad particleWithFile:@"myEffect.plist"];
[my_node addChild:particle_system];

particle_system.position = ccp(xpos, ypos);
[particle_system resetSystem];  

This is working great for me using 0.99.5. You should definitely have the particleWithFile function in the Cocos2D implementation you are using provided you are using 0.99.5.


the partacle system .h should already be in your project when you load it.

the book I'm using initializes the partacle system as

CCParticleSystemQuad* system = [CCParticleSystemQuad particleWithFile:"blah.png"];
[self addChild:system z:1 tag:1];

it doesn't go into any detail other than that for initializing Particle system quads.


if your using cocos2d-iphone-0.99.5

you have to import "CCParticleSystemPoint.h"

and check below linezs also.

refer this word"ARCH_OPTIMAL_PARTICLE_SYSTEM " in your cocos2d libraries "ccparticleexamples.h"

hope this helps you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜