I am making an app that shows the user the possible three dart combinations to end the game "commonly known as checkouts". I'm also wanting to highlight the dart locations on the dart board. I have an SKNode that contains several SKSPriteNodes that make up the highlighted area on the board. I'm wanting to be able to move and rotate that SKNode as to position it over the correct location on the board for that particular dart, and hide it when it's not in use. I am trying to simply change the SKNode's alpha to hide/show the highlighted area, but when I change the SKNode's alpha is does nothing (ie.. alpha set to 0 but it is still showing).
func setupGameScene() {
if let GameScene = SKScene(fileNamed: "DartBoard.sks") {
gameScene = GameScene
} else {
print("gamescene not found")
}
if let BackGround = gameScene.childNode(withName: "BackGround") {
backGround = BackGround as? SKSpriteNode
} else {
print("background not found")
}
if let DartBoard = backGround.childNode(withName: "DartBoard") as? SKSpriteNode {
dartBoard = DartBoard
dartBoard.isHidden = true
} else {
print("dartboard not found")
}
if let SingleLocation = dartBoard.childNode(withName: "SingleLocation") {
singleLocation = SingleLocation
print("SingleLocation found")
singleLocation.alpha = 0
print(singleLocation.alpha)
} else {
print("Single Location not found")
}
this code is working correctly and I'm able to print the alpha of "singleLocation" and it shows it's 0.0. But the node is still visible?
can someone please tell me why this is happening
You could use the sknode proprety isHidden instead of changing it alpha
let wantedNode: SKNode = SKNode()
wantedNode.isHidden = true