如何缩短Cocos2D粒子的寿命?

时间:2021-08-10 10:04:57

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.

我有一个NSObject,上面有粒子属性。我在粒子属性上设置每一个滴答声,以匹配它当前的位置。

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 make 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];

2 个解决方案

#1


3  

I'm not in front of a computer but from memory Life is in seconds.

我不是在电脑前,但从记忆的角度来说,生命只是几秒钟。

So 1s lifespan +/- 1s = 0~2s Life.

所以1s寿命+/- 1 = 0~2s寿命。

A tick is very small, a fraction of second.

蜱虫很小,只有几分之一秒。

Tried setting a small float value like 0.01f ?

尝试设置一个小的浮动值,比如0.01f ?

#2


0  

see this particle tutorial http://www.ferbass.com/2011/05/03/cocos2d-using-particles/

请参阅这个粒子教程http://www.ferbass.com/2011/05/03/cocos2d-using-particles/。

#1


3  

I'm not in front of a computer but from memory Life is in seconds.

我不是在电脑前,但从记忆的角度来说,生命只是几秒钟。

So 1s lifespan +/- 1s = 0~2s Life.

所以1s寿命+/- 1 = 0~2s寿命。

A tick is very small, a fraction of second.

蜱虫很小,只有几分之一秒。

Tried setting a small float value like 0.01f ?

尝试设置一个小的浮动值,比如0.01f ?

#2


0  

see this particle tutorial http://www.ferbass.com/2011/05/03/cocos2d-using-particles/

请参阅这个粒子教程http://www.ferbass.com/2011/05/03/cocos2d-using-particles/。