views:

48

answers:

1

Hi All Im just having an issue with particle effects not appearing all the time. Im coding using objective c and cocos2d for the iphone. Below is the code in question.

CCParticleExplosion *emitter;

    emitter = [[CCParticleExplosion alloc] initWithTotalParticles:30];
    emitter.texture = [[CCTextureCache sharedTextureCache] addImage:@"particle_bubble.png"];
    emitter.position = ccp(MidX,MidY);
    emitter.life =0.5;
    emitter.duration = 0.5;

    emitter.speed = 60;

    [self addChild:emitter];
    emitter.autoRemoveOnFinish = YES;


    ////////////////////////////////////////////////////

    CCParticleMeteor *emitter2;

    emitter2 = [[CCParticleMeteor alloc] initWithTotalParticles:150];

    emitter2.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire_particle.png"];
    emitter2.position = ccp(MidX,MidY);
    emitter2.life = 0.5;
    emitter2.duration = 2;

    emitter2.speed = 60;

    id emitMove = [CCMoveTo     actionWithDuration:0.5 position:HUD.moonSprite.position ];


    [self addChild:emitter2 z:1];

    [emitter2 runAction:[CCSequence actions:emitMove, nil]];
    emitter2.autoRemoveOnFinish = YES;

This code is within the same function right after each other as shown. but sometimes the 2nd particle effect is not created and i cant figure out why. the first particle effect is always created no problems so im sure it is getting into the function correctly but sometimes (almost 50%) the 2nd meteor emitter is not displayed. i have tried messing around with z values to make sure it is not hidden behind an other object and it doesnt appear to be the problem. Anyone have any ideas on why this would be happening? Thanks G

A: 

I suggest using the 71 squared particle designer. http://particledesigner.71squared.com/ Did the trick for me.

Kjelle Vergauwe