Gravity can be modified in SpriteKit. See how to modify gravity settings for a scene in this tutorial.
- [Instructor] In a physics world in SpriteKit,…you have control over gravity.…You set gravity by selecting your scene.…Remember, you can select it in the document outline…or just deselect everything by clicking in the black space…outside of your screen.…In here, I can go to attributes inspector…and then change the gravity settings.…Notice that it has both an X and a Y-value…and that the Y-value is negative,…meaning gravity is pushing downward.…What happens if I delete the minus sign…and press the return key making gravity positive.…
When I hit the Animate button, the objects float up…instead of down.…If I want to, I can increase the gravity a lot…by making it negative 20.…Now gravity is twice as strong as it was before,…I hit the Animate button, the objects move down…much faster.…I could also add gravity on the X-axis.…I'll change the Y back to negative 9.8,…and then I'll change the X to five.…I'll hit the Animate button…and the objects move down into the right.…
This kind of gravity can be excellent if you want…
- Creating a SpriteKit project
- Adding and modifying sprites
- Creating sprites in code
- Transitioning between scenes
- Working with children and parents
- Adding physics
- Detecting and responding to collisions
- Applying particle effects
- Creating actions
- Working with sound
- Adding cameras and lights
Skill Level Intermediate
Careers in the Game Industrywith Christian Bradley1h 19m Beginner
Building a Game App with the Android SDKwith David Gassner2h 6m Intermediate
1. Introduction to SpriteKit
2. Add Physics
3. Work with Particle Effects
4. Work with Actions
5. Work with Audio
6. Additional Features
Next steps1m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.