Sprite Kit Intro (For Swift Playgrounds on the iPad)
Lesson 3- Touch Events
Last Update: 11/24/2017
This is a first draft of the package. Please send any feedback to email@example.com.
- SpriteKitStarter3 Copy it into a new Swift Playgrounds or get Mr.Kurz to AirDrop you the most recent version (Recommended)
In this tutorial you will learn how to:
· Handle screen touch events. You will be setting the y-coordinate of the paddle to the y-coordinate you touched.
· Increase the velocity of a physics body using addImpulse()
· Add fading animation to labels using the run() function.
· Use the update() function to check for certain conditions in the game. In this case, check if the ball went off the screen.
You should also take a look at the makeWallPhysicsBody() function. Anytime you have more than 1 of the same type of node it makes sense to create a function to make the physics bodies for you.
1. If you didn’t want to use the fading animation to make the “Level Up!” appear, what would be some other ways to do it?
2. Why does adding the same impulse to the x and y component of the physics body make the motion look weird? What do you think you could do to fix it?
3. SpriteKit and easily handle multi touch gestures. What would be something you could add to the game that would use multi-touch gestures?