Actions can be created in the edito,r as well as in code. This tutorial shows how to create actions in code and how to use them in your games.
- [Instructor] In a previous movie,…we created an animation for this item on the screen…using the timeline.…I want to look at now how the same animation looks in code.…So, let's head over to GameScene.swift…and I'm going to go to the bottom of didMove to view.…I'll create a few lines there to get some space…and here I'm going to create the action.…So, I'll make it a constant, we'll call it moveAction…and the type is going to be SKAction.…I'll hide the utility area.…
And I'm going to set this equal to SKAction…and actions are class methods of SKAction.…So, I'll type a dot from here…and this is going to be move.…So, we have move and it says by,…then we have move to.…So remember, just like we talked about before,…moving by, means move to the left or the right…or up or down by a certain amount…in the amount specified in the vector…and move to, moves the object to an xy coordinate.…
You also have convenience methods…like this move by and then you receive…an x- and y-coordinate instead of a CGVector.…So, let's use this one 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
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.