在spriteKit中制作一个粒子

我创build了一个粒子,当我在Xcode的属性窗口上testing它时,它看起来像这样:

在这里输入图像说明

我已经将这个粒子添加到场景中,做了一个圆圈,并迫使粒子运行这个圆圈:

NSString *myParticlePath = [[NSBundle mainBundle] pathForResource:@"particle" ofType:@"sks"]; SKEmitterNode *myParticle = [NSKeyedUnarchiver unarchiveObjectWithFile:myParticlePath]; [self addChild:myParticle]; CGPathRef circle = CGPathCreateWithEllipseInRect(CGRectMake(0,0,400,400), NULL); SKAction *followTrack = [SKAction followPath:circle asOffset:NO orientToPath:YES duration:1.0]; SKAction *forever = [SKAction repeatActionForever:followTrack]; [myParticle runAction:forever]; 

这是它的样子。 就像一块白糖糖。 节点粒子跟随path,但不是生成的粒子。

我用虚线表示了一个圆圈,所以你可以看到它所遵循的path。

在这里输入图像说明

有任何想法吗?

谢谢

你发送粒子发射器来跟踪path。 如果您希望单个粒子运行某个操作,请使用发射器的particleAction属性:

 myParticle.particleAction = forever;