How do I shorten Cocos2D particle lifespan?
I've tried experimenting with low life, low life var but the particles seem to hang around for a few seconds. I want them to fade quicker.
I have an NSObject which has a particles property on it. I setPosition every tick on the particles property to match it's current location.
I am trying to move a series of particles like a "plasma bolt" effect, so that it's a tight ball of particles and not hanging around.
How can I shorten the lifespan so the particles only last for say, a tick or two, and generate more every tick? (Or simply 开发者_StackOverflowmake them once and move every tick).
Thanks
self.particles = [[CCParticleMeteor alloc] initWithTotalParticles:250];
[self.particles setPosition:self.l];
[self.particles setAngle:0.0];
[self.particles setAngleVar:0.0];
[self.particles setStartSize:1.5];
[self.particles setPosVar:CGPointMake(0,0)];
[self.particles setEndSize:0.5];
[self.particles setLife:1];
[self.particles setLifeVar:1];
[self.particles setSpeed:0];
[self.particles setSourcePosition:CGPointMake(0,0)];
[self.particles setTexture:nil];
I'm not in front of a computer but from memory Life is in seconds.
So 1s lifespan +/- 1s = 0~2s Life.
A tick is very small, a fraction of second.
Tried setting a small float value like 0.01f ?
see this particle tutorial http://www.ferbass.com/2011/05/03/cocos2d-using-particles/
精彩评论