pulitr pulitr - 1 year ago 53
iOS Question

Removing all copies of the SKSpriteNode

In loop I have this line and I need to remove all copies. How would I be able to do this in Swift in SpriteKit?

obstacles = obstaclesImage.copy() as! SKSpriteNode


Name your nodes:

obstacleCopy.name = "obstacleCopy"

Then enumerate their parent:

self.enumerateChildNodesWithName("obstacleCopy") {
    node, stop in