2
有點古怪這裏,我有一個粒子發射器添加到SKShapeNode (顆粒應該跟隨線)myParticleEmitter古怪(0.0創建僞影)而從A點繪製到B點
然而當它它也有一個有點粒子系統,坐在0,0 伊夫的移動起來一點,所以你可以看到它更好
任何想法如何這可能發生?, 我會發佈下面的代碼,但我仍然無法找到任何東西,我測試過其他紋理設置setStrokeTexture - incase線正在做一些鬼鬼祟祟的額外部分 - 但沒有它看起來很好....並創建在LinkWithNumberClass精靈之間的線......
// SKSpriteNode SKPhysicsContactDelegate
if (isUsingParticles == YES) {
//create new line
SKShapeNode*lineNode02 = [SKShapeNode node];
lineNode02.lineWidth = 10;
lineNode02.name = @"lineNode";
//clear line of colour
lineNode02.fillColor = [SKColor clearColor];
lineNode02.strokeColor = [SKColor clearColor];
//create the path the line follows (line joins two sprites)
CGMutablePathRef pathToDraw = CGPathCreateMutable();
CGPathMoveToPoint(pathToDraw, NULL, spriteA.position.x, spriteA.position.y);
CGPathAddLineToPoint(pathToDraw, NULL, spriteB.position.x, spriteB.position.y);
lineNode02.path = pathToDraw;
[self addChild:lineNode02];
//Add Particles
myParticlePath = [[NSBundle mainBundle] pathForResource:_parName ofType:@"sks"];
myParticleEmitter = [NSKeyedUnarchiver unarchiveObjectWithFile:myParticlePath];
[self addChild:myParticleEmitter];
CGFloat distancebtween = SDistanceBetweenPoints(spriteA.position, spriteB.position);
myParticleEmitter.particlePositionRange = CGVectorMake(particleLength,0);
myParticleEmitter.position = CGPointMake(distancebtween/2, +10);
self->myParticleEmitter.targetNode = self.scene;
int particleTime = 3;
SKAction *followTrack =
[SKAction followPath:pathToDraw
asOffset:YES
orientToPath:YES
duration:particleTime];
SKAction *forever = [SKAction repeatActionForever:followTrack];
self->myParticleEmitter.particleAction = forever;
}
在遊戲層
-(void)addStaticLinkedSpriteWithParticles
{
twoSpritesWithParticlesBridge =
[[LinkWithNumber alloc]initWithlinkSpriteA:@"Object"
spriteB:@"Object"
andPlistAnimation:@"Aniamtions"
distbetween:100
hasParticles:YES
ParticlesNamed:@"Fire"];
[self addChild:self->twoSpritesWithParticlesBridge];
}
謝謝:) 娜塔莉。