swift - Sprite Kit and type inference -


So I'm creating a Sprite Kit game and at a certain point I enable / disable gravity on some nodes Want to

I managed to do it, but I was wondering if there is a better way of achieving this.

Here's my code:

  Enable raw bubbles in the func container! Give children bubble = raw bubble as SKShapeNode bubble.physicsBody .dynamic = true}}  

While not using type mists on raw bubble, I get this error: < Code> SKPhysicsBody? I do not think there is a problem with the sprite kit, but there is more swift than this, is it possible to do it in another easy way?

Thank you.

Since container !. Child is an before you can make everything useful with them, before you put your content. The safest way I can think, is to put it in the [SKNode] statement for :

  func enableGravity () { For bubbles in the container !! Children as [SKNode] {bubble.physicsBody? .dynamic = true}}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -