Lahav
Lahav

Reputation: 791

Make an SKSpriteNode transparent

Is it possible to make an SKSpriteNode totally transparent, while keeping its dimensions? If so, how? I want the object to still have a physicsBody and still be a child of gameScene, however I don't want it to be visible.

Upvotes: 0

Views: 2697

Answers (2)

Devapploper
Devapploper

Reputation: 6192

You could also just hide your node with this simple line.

yourNode.hidden = true

Upvotes: 0

Fantattitude
Fantattitude

Reputation: 1842

SKSpriteNode's superclass SKNode has a member called alpha which let you set the opacity of the node I think it might not affect your sprite Physics.

let spriteNode = SKSpriteNode() // You should already have it
spriteNode.alpha = 0.0          // This should make your node transparent without affecting its physics interactions

Upvotes: 3

Related Questions