0
votes

In my recent Spritekit project, I want a node which the user can move and it shows it movement track as below

I was thinking of using the SKEmitterNode to achieve that,but the particles aren't so "separate" from each other

enter image description here

1

1 Answers

1
votes

Try leaving behind x number of copies of your original sprite, but start an SKAction to fade the alpha to 0, and perhaps scale the size to 0 as well. Create a NSTimer to remove old sprites after a second or two. place this code where you move your main sprite that you wiant a tail of

//copy the sprite that is moving around
let newSprite = theMovingNode.copy()

//fade and shrink our new sprite
newSprite.runAction(SKAction.FadeAlphaTo(0,duration:2.0))
newSprite.runAction(SKAction.ScaleTo(0,duration:2.0))

// create a timer to remove this sprite in 2 seconds
let timer = NSTimer.scheduledTimerWithTimeInterval(2, target: self, selector: Selector("removeTailSprite:"), userInfo: newSprite, repeats: false)