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 trial
Sabrina Polakoff
2,767 PointsHow do I have to change an image when I tap it and while my finger is on it in a SpriteKit game?
This is an example of what it should look like.
1 Answer
Marshall Huss
3,504 PointsSpriteKit handles touches a bit differently than UIKit. Usually you handle any touch logic in your SKScene -touchesBegan:withEvent: method.
In that method when a touch happens you can enumerate your child nodes and see if it's one of your buttons. If that's the case then highlight, swap images, or whatever else you want to do.