So I'm building a Sprite Kit game and at a certain point I want to enable/disable gravity on some of my nodes.
I managed to do it but I just was wondering if there is a better way to achieve this.
Here's my code:
func enableGravity() {
for rawBubble in container!.children {
let bubble = rawBubble as SKShapeNode
bubble.physicsBody?.dynamic = true
}
}
When not using type inference on rawBubble, I get this error : SKPhysicsBody? does not have a member named dynamic
I guess this is not really a Sprite Kit related issue but more Swift itself. Is it possible to do this in a more simple way?
Thanks.
dynamic
was relevant but thanks I forgot this property. - Skoua