1

This is how my emitterLayer is set up:

emitterLayer.position = CGPointMake(sumIndent
                                    ,_emitterView.frame.origin.y);

emitterLayer.backgroundColor = [[UIColor clearColor] CGColor];


emitterLayer.emitterPosition = CGPointZero;

emitterLayer.emitterSize = CGSizeMake(100, 100);

emitterLayer.emitterShape = kCAEmitterLayerBackToFront;

[_emitterView.layer addSublayer:emitterLayer];

This is how my emitterCell is set up:

CAEmitterCell * coinCell = [CAEmitterCell emitterCell];

coinCell.name = @"coins";

coinCell.contents = (id) [[UIImage imageNamed:@"smallCoin.png"] CGImage];

coinCell.birthRate = 0;

coinCell.lifetime = 0.3;
coinCell.lifetimeRange = 1.1;

coinCell.velocity = 900;

coinCell.emissionRange = 2 * M_PI;

coinCell.spin = 0.0;
coinCell.spinRange = 7 * M_PI;

coinCell.scale = 1.85;
coinCell.alphaSpeed=-1.0/coinCell.lifetime;

And this is how I start/stop the animation:

 [emitterLayer setValue:[NSNumber numberWithInt:PARTICLE_INTENSITY] forKeyPath:@"emitterCells.coins.birthRate"];

 [emitterLayer setValue:[NSNumber numberWithInt:0] forKeyPath:@"emitterCells.coins.birthRate"];

I need for all the particles to be created instantly so that I can have an explosion effect. The way this is set up they only spawn one by one.

0 Answers0