I prototype games using shapes, and spritekit was awesome for that before swift.
Now when i try to extend a SKSpriteNode and add my init function, I can't call super.init(color, size).
I have no way to call the code that creates the shape texture.
I need to know how to either call that init function, or how to create the shape texture, so I can override the designated init, then call it using my shape texture.
EDIT: Here is the exact code I'm doing and I do almost the exact same thing in another SKSprite node extended class:
class TetrisCell : SKSpriteNode
{
let length = 10;
convenience init(color:UIColor) {
var size = CGSize(width: length, height: length);
//Not allowed to call a super's convenience init, must call non-convenience init
super.init(color: color, size: size);
}
}
I understand why it won't let me, so I'm looking for another way around. For now, the TetrisCell doesn't have a texture. I'd like to simply use shapes for convenience.
From what I can tell I HAVE to call super.init(texture:,color:,size:) in order to initialize my SKSpriteNode. If there is no way to do the above code, then I'd like to know what they set their SKTexture to, so I can mimic it. Something like super.init(texture: SKTexture.blankTexture) or something. Whatever they put as the texture is manipulated by the color: attribute, while my 1x1 pixel doesn't seem to be affected by the color: attribute.