I just upgraded to cocos2d 0.8 and am having problems getting my particle system to show up again. I've looked at the ParticleTest.m file and have my code compiling but can't get the particles to display.
This is my (messy) method where I'm created the particle system.
-(void)createParticleSystem:(cpBody*)body
{
BloodParticleSystem* emitter = [[BloodParticleSystem alloc] initWithTotalParticles:25];
float mag = cpvlength(body->v);
ccColor4F startColor = {1.0f, 0.1f, 0.1f, 1.0f};
ccColor4F endColor = {1.0f, 0.1f, 0.1f, 0.0f};
emitter.startColor = startColor;
emitter.endColor = endColor;
emitter.duration = .5f;
emitter.life = 3.5f;
emitter.lifeVar = 0.15f;
emitter.speed = (mag/8);
emitter.angle = cpvtoangle(cpvperp(body->v)) * (180/M_PI);
emitter.angleVar = rand()%30;
emitter.gravity = cpv(0, -200);
// size, in pixels
emitter.startSize = 11.0f;
emitter.startSizeVar = 00.0f;
emitter.endSize = kParticleStartSizeEqualToEndSize;
// emits per second
emitter.emissionRate = 100;
emitter.texture = [[TextureMgr sharedTextureMgr] addImage: @"snow.png"];
emitter.position = cpv(body->p.x, body->p.y);
[self addChild:emitter];
[emitter release];
}
BloodParticleSystem is simply a subclass of ParticleSystem class that implements the step method. Had to do that otherwise exceptions occured.
Appreciate any help.
Thanks,
Kevin