Question

Now this might seem like a really stupid question, and while it probably is, it isn't because I have tried for 2 minutes following a tutorial then failing. I've spent the past two hours or so trying to figure this out, with no success. My question is really simple.. How do I add a particle effect from a "Particle Designer" plist particle. I've tried pretty much everything, but the amount of resources on the internet is limited.

I used a default particle effect, exported as .plist and added it and the image to my project. I checked if the image is properly imported, it is. I then tried different variations of

CCParticleSystem *particle = [[CCParticleSystem alloc]initWithFile:@"splashAnim.plist"];
CCParticleSystem *particle = [CCParticleSystem initWithFile:@"splashAnim.plist"];
particle.position = spriteIWantToLocateAt.position;
[self addChild:particle z:1000];

I've tried logging its position to check if its in the view (it is), I've tried checking if .isRunning returns true, it is... But I can't see it! It's invisible! And I started a fresh project just to try it again, and it doesn't want to work. Both with and without ARC, if that makes a difference. I'm using cocos2d v2.1. Here are the particle files I want to implement: http://www.mediafire.com/?mz1gjxvpyc5jy1u

Anything really obvious i'm doing wrong, any help or anything at all? :)

Was it helpful?

Solution

I'm not 100% positive on this but it's worth giving a shot: I believe in cocos2d 2.x you actually have to use CCParticleSystemQuad:

CCParticleSystem *particle = [CCParticleSystemQuad particleWithFile:@"fx.plist"];

PS: I prefer to use the class method initializers instead of alloc/init but that should work too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top