0
我想让我的宇宙飞船拥有跟随它的粒子轨迹。我将如何做到这一点?Spritekit添加粒子
这是我为我的飞船代码:
override func didMove(to view: SKView) {
spaceS.position = CGPoint(x: self.frame.width/2, y: self.frame.height/2)
spaceS.setScale(0.05)
spaceS.zPosition = 1
addChild(spaceS)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
spaceS.position = CGPoint(x: location.x, y: location.y)
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
spaceS.position = CGPoint(x: location.x, y: location.y)
}
}
编辑1:火灾粒子踪迹更确切地说
如果精灵太小火没有出现,而且它也出现在了中间sprite –
我会更好地解释我的最后一条评论。如果粒子设置为较小的比例,它会出现在精灵的中间(它不会消失) –
也许你的精灵比较小。试着缩小你的粒子的大小。如果我的答案有助于解决问题,您应该接受答案或upvote。 – Joe