我可以为SKNode附加标签吗?

Can I Attach a Label to a SKNode?

我正在创建一个需要将标签附加到节点的游戏,因为我将它用作按钮并且按钮会四处移动。有谁知道如何将标签附加到 SpriteKit 节点?

SKLabel,你可以用那个

let scoreLabel = SKLabelNode(fontNamed: "Chalkduster")
scoreLabel.text = "Score: 0"
scoreLabel.horizontalAlignmentMode = .right
scoreLabel.position = CGPoint(x: 980, y: 700)
addChild(scoreLabel)

您需要调查 SpriteKit 中的 parent 和 child 节点。您的标签最终将成为 SKLabel 和 child 按钮点头。因此它会移动、缩放、旋转等 parent.