I would like to create a subclass of SKShapeNode in order to draw triangles and add a little extra structure. I need to rotate these about the center of their bounding box, so would like to imitate the SKShapeNode init(path: CGPath, centered: Bool). However this is a convenience initializer and so cannot be accessed from the subclass. I dont have any difficulty defining the path in the subclass, but the question is how to get it centered? (SKShapeNode does not seem to have a property for this.)
import SpriteKit
class mySKShapeNode: SKShapeNode {
class mySKShapeNode : SKShapeNode {
override init( ) {
super.init( )
}
convenience init( path: CGPath, centered: Bool) {
self.init( )
self.path = path
// How to get it centered????
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
}