How to add a SKSpriteNode to the scene in Swift?
问题 I tried to subclass SKSpriteNode into GameObject and I would like to instantiate objects outside the game scene class. Here is my GameObject code derived from SKSpriteNode : import SpriteKit public class GameObject: SKSpriteNode { init( texture: SKTexture?, color: UIColor, size: CGSize, position:CGPoint, name:String ) { objectSize = size; objectName = name; objectSprite = texture; //call superclass here super.init(texture: texture, color: color, size: size); self.position = position; }