Game Development Reference
In-Depth Information
For the customized particle effect in the ParticleEffects01 project, I've created the
ParticleEffectSelfMade class. The interface of this class is in Listing 9-2 .
Listing 9-2 . Subclassing from the Optimal Particle System Class
#import < Foundation/Foundation.h>
#import "cocos2d.h"
@interface ParticleEffectSelfMade : CCParticleSystemQuad
Now you'll look at the implementation of the self-made particle effect, which uses all
the available properties. I'll attempt to explain each of them, but it's much better to see
it for yourself and experiment with the parameters, so I encourage you to tweak the
properties in this project. In the ParticleEffects01 project ( Listing 9-3 ), you'll
also find comments describing each parameter in brief.
Listing 9-3 . Manually Setting a Particle System's Properties
#import "ParticleEffectSelfMade.h"
@implementation ParticleEffectSelfMade
-(id) init
return [self initWithTotalParticles:250];
-(id) initWithTotalParticles:(int)numParticles
self = [super initWithTotalParticles:numParticles];
if (self)
self.duration = kCCParticleDurationInfinity;
self.emitterMode = kCCParticleModeGravity;
// some properties must only be used with a specific emitterMode!
if (self.emitterMode == kCCParticleModeGravity)
Search Nedrilad ::

Custom Search