Join Todd Perkins for an in-depth discussion in this video Create actions with code, part of iOS Game Development: Swift 2.0 and SpriteKit.
- So we have looked at creating an action…in our SpriteKit scene file in multiple ways,…but we haven't yet looked at how…to create an animation with code.…So on the screen here, I have a block selected.…it's just a red square,…and I have physics properties on it.…It's static and it's called "block".…So that's it's name in the name field.…So let's go over to GameScene.swift…and we're going to create a variable to reference this,…just like "cannon".…So I'm going into line 18 here, and I'm copying that,…I'll change "cannon" to "block" in the copied code,…and then I'm going to go to line 24,…re-instantiate the "cannon",…and copy and paste that as well,…changing "cannon" to "block" both in the name…of the variable, and in the string.…
So now, we have an element called "block"…that we can reference with our code.…So, how do we make it rotate forever?…Step 1: We decide the amount of degrees…we want to rotate by.…So I'm going to define degrees as 90.0,…just like we did before,…90 degrees over the space of one second.…Let's go to the next line,…
- 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
Game Design Careers with Brenda Romerowith Brenda Romero54m 41s Beginner
iOS 9 App Development: GamePlayKitwith Tammy Coron1h 31m 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.