no designated init for SKShapeNode(circleOfRadius: radius)
how's this?
class Player: SKShapeNode {
init(circleOfRadius: CGFloat){
super.init()
let diameter = circleOfRadius * 2
self.path = CGPathCreateWithEllipseInRect(CGRect(origin: CGPointZero, size: CGSize(width: diameter, height: diameter)), nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
This worked for us.
It allows you to use other convenience initializers from SKShapeNode
, but it has weird syntax explained here: https://stackoverflow.com/a/24536826/144088
class CircleNode : SKShapeNode {
override init() {
super.init()
}
convenience init(width: CGFloat, point: CGPoint) {
self.init()
self.init(circleOfRadius: width/2)
// Do stuff
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}