我有一个名为“Ghost”的 SKSpritenode,我正在尝试向图像外部添加脉动的外观。但是我收到一个错误,说它没有中心,我不知道如何解决这个问题,请帮忙。
func addPulse(){
let pulse = Pulsing(numberOfPulses: .infinity , radius: 110, position: Ghost.center)
pulse.animationDuration = 1.0
pulse.backgroundColor = UIColor.blue.cgColor
self.view.layer.insertSublayer(pulse, below: Ghost.layer)
}
最佳答案
SKSpriteNode
扩展 SKNode
。两者都没有 center
属性。但是,有frame
和position
。使用其中一个属性而不是 center
。
let pulse = Pulsing(numberOfPulses: .infinity , radius: 110, position: Ghost.position)
关于ios - SkSpriteNode没有成员(member)中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41887172/