How to add `SKEmitterNode` on `CGMutablePath` in Swift 4?

67 views Asked by At

I have a spaceship that is flying on an ellipse track. See code below.

I would like to add SKEmitterNodes as 'gas emissions' on the track. How can I add SKEmitterNode on location at path after the ship has passed?

let shipSprite = SKSpriteNode(texture: SKTexture(image: #imageLiteral(resourceName: "spaceShip")))
let shipPoint = CGPoint(x: self.size.width/4, y: self.size.height/2)

let pathOfShip = CGMutablePath()
pathOfShip.addEllipse(in: CGRect(origin: CGPoint(x: 40,y: -20), size: CGSize(width: -80, height: -130)))

shipSprite.run(SKAction.follow(pathOfShip, asOffset: true, orientToPath: true, duration: 5.0))
0

There are 0 answers