开发者

How do I shorten Cocos2D particle lifespan?

开发者 https://www.devze.com 2023-02-28 02:29 出处:网络
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'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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号