Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialArtur Stringa
53 PointsHow to increment,save score and display on the iphone screen
On the file Game View Controller I have this function override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { let touch = touches.first! let location = touch.location(in: gameView) let hitList = gameView.hitTest(location, options: nil) if let hitObject = hitList.first { let node = hitObject.node if node.name == "Friend" { node.removeFromParentNode() self.gameView.backgroundColor = UIColor.black
}else{
node.removeFromParentNode()
self.gameView.backgroundColor = UIColor.red
}
}
}
I want when node.name is Friend to display on the iPhone screen and continue increment the score for every time it is a friend