I can create a SKShapeNode(rectOf: CGSize) with ease. But for having cleaner code, and adding new properties I am trying to subclass it.
So what I would love to do is:
class PegBaseBoard : SKShapeNode { var custom1 : String var custom2: Int init() { super.init() //do all positioning here //set additional properties here } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
And then from my scene create an instance of the PegBaseBoard class with some extra values passed in. Even when I type it in a way that the compiler sees no errors, I am unable to get this done.
If anyone can help me, I would so appreciate it. I’ve also put in for a tutorial request on this. This seems to go beyond subclassing 2 or 3 classes that I made.
Thank you
As hard as I try to put passed values in init() or super.init I just can’t seem to make it work. I have exhausted Google, StackOverflow, Apple, etc.