User data gives you the ability to add key-value pairs to objects through the editor. See how that works in this tutorial, and how to properly handle collision errors.
- [Instructor] Let's say you have a bunch of different items…similar to this but they're all in the item category…and the player can touch them and pick them up,…but they're worth different amounts of points.…You can actually handle this problem very easily…using something called user data.…If I select my item right here…and scroll down in the attributes inspector…to the user data area,…I can click the plus button and I can create a property.…I'll call this points.…User data is actually a dictionary…that's attached to the object,…so you can create as many of these entries as you want.…
More with the plus button and you can remove 'em…with the minus button after they're selected.…You can choose their type.…I'll choose integer for now.…Then you can set a value.…We'll give this a value of 100.…We'll look at how to deal with that in code…in just a second.…I just want to point out that I've added a label node…from the object library…and just dropped it on the screen here,…and I've given it a name of label.…In my code, I have created…
- 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?
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.