Make an SKSpriteNode transparent

时间:2015-07-28 22:54:15

标签: swift skspritenode invisible

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.

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

你也可以用这个简单的行隐藏你的节点

yourNode.hidden = true