pulitr pulitr - 1 year ago 79
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

Answer Source

Name your nodes:

obstacleCopy.name = "obstacleCopy"

Then enumerate their parent:

self.enumerateChildNodesWithName("obstacleCopy") {
    node, stop in 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download