如何缩短Cocos2D粒子的寿命?
我尝试过低寿命、低寿命变量的实验,但粒子似乎会停留几秒钟。我想让它们褪得更快。
我有一个 NSObject,它有一个 keywords 属性。我设置粒子属性上的每个刻度以匹配其当前位置。
我试图像“等离子螺栓”效果一样移动一系列粒子,使其成为一个紧密的粒子球,而不是悬挂在周围。
如何才能缩短粒子的寿命,使粒子只持续一两个滴答声,并在每次滴答声中产生更多的粒子? (或者简单地制作一次并移动每个刻度)。
谢谢
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'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 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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不是在电脑前,而是凭着记忆生命就在几秒钟内。
所以 1s 寿命 +/- 1s = 0~2s 寿命。
一个刻度非常小,只有几分之一秒。
尝试设置一个小的浮点值,例如 0.01f ?
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 ?
请参阅此粒子教程 http://www.ferbass.com/2011/ 05/03/cocos2d-using-articles/
see this particle tutorial http://www.ferbass.com/2011/05/03/cocos2d-using-particles/