CCParticleSystem Prewarm Extension / Category
We've been playing with particle effects in our latest title, Poker Puzzle Tour. It's the first time we've used particle systems and it's hard to not get too carried away with them. The joke in the office is to not go all lens flare crazy with it - not overuse them too much.
Here's a small extension for Cocos2D's CCParticleSystem I put together last week to aid our efforts. The Unity game engine lets you "prewarm" your particle effects, basically start them mid-cycle. Cocos2D doesn't currently have the ability to do this, so I hacked together a simple "prewarm" method. Nothing fancy, but it's been working well for us.
@implementation CCParticleSystem (EF) - (void)prewarm { CCTime elapsed = 0.0; CCTime prewarm = _life + _lifeVar / 2.0; while (elapsed < prewarm) { CCTime dt = [EFMathHelper randomDoubleBetweenMin:0.0 max:0.1]; if (dt > 0.0) { elapsed += dt; [self update:dt]; } } } @end
Particle Effect at Initialization w/ Prewarm
Alexander Wong http://alexanderwong.me











