我有一个名为“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属性。但是,有frameposition。使用这些属性之一代替center

let pulse = Pulsing(numberOfPulses: .infinity , radius: 110, position: Ghost.position)

关于ios - SkSpriteNode没有成员(member)中心,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41887172/

10-09 06:04