I've plugged in the example code for particles (or what I thought the relevant parts of it were) into my project, to see if I can get a bunch of particles to just show up on screen, but its not working. I have a Particle System declared in my header file, and I have a function that's called on startup which I've named setupEmitter(). Here's the code for it:
- (void) setupEmitter {
emitter = [[QuadParticleSystem alloc] initWithTotalParticles:50];
[self addChild: emitter z:10];
//emitter.texture = particles;
emitter.texture = [[TextureMgr sharedTextureMgr] addImage: @"aimstick.png"];
// duration
emitter.duration = -1;
// gravity
emitter.gravity = CGPointZero;
// angle
emitter.angle = 90;
emitter.angleVar = 360;
// speed of particles
emitter.speed = 160;
emitter.speedVar = 20;
// radial
emitter.radialAccel = -120;
emitter.radialAccelVar = 0;
// tagential
emitter.tangentialAccel = 30;
emitter.tangentialAccelVar = 0;
// emitter position
emitter.position = ccp(160,240);
emitter.posVar = CGPointZero;
// life of particles
emitter.life = 4;
emitter.lifeVar = 1;
// spin of particles
emitter.startSpin = 0;
emitter.startSpinVar = 0;
emitter.endSpin = 0;
emitter.endSpinVar = 0;
// color of particles
ccColor4F startColor = {0.5f, 0.5f, 0.5f, 1.0f};
emitter.startColor = startColor;
ccColor4F startColorVar = {0.5f, 0.5f, 0.5f, 1.0f};
emitter.startColorVar = startColorVar;
ccColor4F endColor = {0.1f, 0.1f, 0.1f, 0.2f};
emitter.endColor = endColor;
ccColor4F endColorVar = {0.1f, 0.1f, 0.1f, 0.2f};
emitter.endColorVar = endColorVar;
// size, in pixels
emitter.startSize = 80.0f;
emitter.startSizeVar = 40.0f;
emitter.endSize = kParticleStartSizeEqualToEndSize;
// emits per second
emitter.emissionRate = emitter.totalParticles/emitter.life;
// additive
emitter.blendAdditive = YES;
}
What am I doing wrong?