因此,我有一个类,它是SKSpriteNode的一个子类,我希望当它的父节点发生变化时,通知它,或者如果它没有父节点的话,那么场景,这样我就知道它的容器的大小了。我试着做以下几件事:
override var parent: SKNode?parent'; it can't change和Cannot observe read-only property 'scene'; it c
因此,我正在使用SpriteKit和Swift开发一个小游戏,我对SKSpriteNode进行了子类化,添加了一些额外的属性,并覆盖了touchesBegan()。class Digit : SKSpriteNode { var index = 0
...SKScene类("GameScene")中的,它当然有自己的逻辑和touchesBegan()函数,它在那里,但目前还没有任何代码。,当被点击时
在我的自定义SKSpriteNode类中,我希望能够在自定义类中更改属性,如anchorPoint、posistion等,这样我就不需要在其他地方更改。import Foundation super.init(texture:coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been