swift - SKSpriteNodes in SKView -


i trying skspritenodes in skview change alpha. here's code:

if let nodes = self.gameskview.scene!.children as? [skspritenode] {         node in nodes {             if node.name != "bg" {                 node.alpha = 0             }         } } 

with codes, nodes nil when print in gameskview not nil.

println("\(self.gameskview.scene!.children)") 

can try me? in advance.

self.gameskview.scene!.children as? [skspritenode] 

is non-null if all children skspritenode - as? not filter select elements of particular type, it's type-safe "cast".

i's difficult provide advice how want without knowing want accomplish , more of code.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -