lundi 20 juin 2016

Swift 2.x: searching the node tree for multiple hits

I want to search my SKScene class for childNodes that begin with "spaceship". Basically I have several spaceship nodes named "spaceship1", "spaceship2", "spaceship3", etc...

However I'm not getting the syntax right. This:

self.subscript("spaceship[0-9]")

results to :

 Expected ',' separator

And this:

self.objectForKeyedSubscript("spaceship[0-9]")

Results to :

'objectForKeyedSubscript' is unavailable: use subscripting

Aucun commentaire:

Enregistrer un commentaire