BWSnippet

Sprite Kit re-use & dynamically use SKNodes from graphical sks files

Sprite Kit re-use & dynamically use SKNodes from graphical sks files

I want to be able to create an SKNode in xcode but be able to re-use that node in multiple scenes without using the reference node object.

        //Define a object to use later to refer to the new object
        var tmpKP:Kitty!
        if let object = self.sceneWithObject.objectInScene {
            //remove this object so we dont get yelled at "sknode already has a parent"
            object.removeFromParent()
            tmpKP = object
            self.addChild( tmpKP )
        }

Tags

Sprite Kit re-use & dynamically use SKNodes from graphical sks files