Still new, but slowly building my first game, and getting there.
I'd like to be able to add a fading streak or trail as one my SKSpriteNodes returns to it's home base.
The only thing I can think of is calculating the distance, breaking it down into x moments, then gradually move the Sprite a little, with some fade options, and then repeat in a loop till it gets back to home base.
I know that has to be wrong because it's just so ugly.
When I look at the Sprite Kit's Particle File, it has so few options. And I'm not really sure that's what I should be looking at. I have also looked at SKAction's options, and if there's an option there I'm missing it. A good book or website dedicated to SKAction would be nice.
But right am just looking for my solution.
Thanks as always
I'd like to be able to add a fading streak or trail as one my SKSpriteNodes returns to it's home base.
The only thing I can think of is calculating the distance, breaking it down into x moments, then gradually move the Sprite a little, with some fade options, and then repeat in a loop till it gets back to home base.
I know that has to be wrong because it's just so ugly.
When I look at the Sprite Kit's Particle File, it has so few options. And I'm not really sure that's what I should be looking at. I have also looked at SKAction's options, and if there's an option there I'm missing it. A good book or website dedicated to SKAction would be nice.
But right am just looking for my solution.
Thanks as always
You could use an SKEmitterNode and change the settings so hit looks like a trail.
To make a new emitter node, choose File -> New and search "SpriteKit Particle File".
Name it Trail
Here are the settings I would set:
Texture: spark (this is one of apple's defaults, but you can use your own)
Emitter: birthrate: 20, maximum: 0
Lifetime: start: 8, range: 0
Position: All of these fields set to 0
Alpha: 0.6, range: 0, speed: -0.06
Scale: 1, range: 0, speed: 0
Rotation: All these fields set to 0
Color Blend: factor: 1, range: 0, speed: 0
To use it in code:
Add it to the node you want to have a trail:
Hope this helps!
To make a new emitter node, choose File -> New and search "SpriteKit Particle File".
Name it Trail
Here are the settings I would set:
Texture: spark (this is one of apple's defaults, but you can use your own)
Emitter: birthrate: 20, maximum: 0
Lifetime: start: 8, range: 0
Position: All of these fields set to 0
Alpha: 0.6, range: 0, speed: -0.06
Scale: 1, range: 0, speed: 0
Rotation: All these fields set to 0
Color Blend: factor: 1, range: 0, speed: 0
To use it in code:
Code Block let emitterNode = SKEmitterNode(fileNamed: "Trail") // or whatever you named your file
Add it to the node you want to have a trail:
Code Block yourNode.addChild(emitterNode)
Hope this helps!