See how to add physics properties to sprites in this SpriteKit tutorial, including how to add a physics body, and how to control the shape of a physics body.
- [Instructor] SpriteKit makes it easy to apply physics…directly through the SpriteKit scene editor.…Let's start by creating a floor.…I'll click and drag out a color sprite…and then I'm going to scroll down a little bit…and stretch the sprite out to cover the ground.…So this is going to be our floor right here,…this red rectangle.…So now I'm going to click and drag out another color sprite…and I'll change its color to green…and this box is going to be a physics box.…
So what it's going to do is fall down…and we want it to collide with the floor.…So the box should be affected by gravity…and the floor should not.…It should just stay there and act like a floor.…So let's apply physics to the box first.…So I have it selected right here…and in the Attributes Inspector I'm going to scroll down…and find the Physics Definition section…and change the Body Type to Bounding rectangle.…Note that these different body types…apply to the physics shape of the object,…not necessarily the shape of the object itself.…
So even though I have a square right here,…
- 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
Game Design Careers with Brenda Romerowith Brenda Romero54m 41s Beginner
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.