Join Todd Perkins for an in-depth discussion in this video Create an action sequence with code, part of iOS Game Development: Swift 2.0 and SpriteKit.
- Now that we've looked at how…to run action sequences in a timeline…in a SpriteKit scene, let's look at how…to apply the same principle in code.…So here I have my bucket on the screen…and I've actually named it bucket,…so you can see if you look in Attributes Inspector,…I've given it that name so I can reference it…with code.…So save the file and head on over…to gamescene.swift…where I've created a variable called bucket,…and I've instantiated it on line 27,…just like we've done before.…
So let's go to the bottom of didMoveToView…and we're going to define how this is going to work.…Remember, we need to have one action moving…to the right, one action moving to the left,…those actions need to have easing,…we need to run them into sequence,…and it needs to repeat forever,…so let's look at how that works.…So we'll let a1, short for action one,…equal SKAction, and the action's going…to be moveBy, and I'm going to use moveByX.…Now you can use that or you can use moveBy…with a CGVector.…
Remember, a CGVector is just an XY coordinate…
- Creating a new SpriteKit project
- Adding and modifying sprites
- Transitioning between scenes
- Removing child sprites from parents
- Working with gravity, forces, and impulses
- Detecting collisions
- Applying particle effects
- Creating actions and action sequences
- Working with audio
- Creating frame animations
- Using cameras and lights
Skill Level Intermediate
iOS 9 App Development: GamePlayKitwith Tammy Coron1h 32m Intermediate
1. Introduction to SpriteKit
2. Add Physics
3. Work with Particle Effects
4. Work with Actions
Use an action sequence4m 8s
5. Work with Audio
6. Additional Features
- 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.