我有一艘飞船在椭圆轨道上飞行。见下面的代码。
我想在赛道上添加SKEmitterNode
作为“气体排放”。如何在船舶通过后在路径上添加SKEmitterNode
?
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))