Join Todd Perkins for an in-depth discussion in this video Create a SpriteKit project, part of iOS Game Development: Swift 2.0 and SpriteKit.
- Let's create a Spritekit project. To do that, just create a new Xcode project like you'd normally do and you'll see options to create game under IOS application, tvOS application, and OS 10 application. For this course we're going to be focusing on IOS applications. So I'm going to select application under IOS. Click on game and then click next. For the product name, I'll call this SpriteKitIntro.
Make sure Swift is the language. The game technology is set to SpriteKit. And for devices use iPhone and then click next. And I'm going to save this in my exercise files folder on the desktop. Now if you don't have the exercise files you can save this wherever you'd like. If you do have the exercise files, save in chapter one creating project, but don't save inside the final folder because I'm saving my project there right now. So I'm clicking on that and clicking create. And here we are in our SpriteKit project.
Now, it pretty much looks like a normal XCode project except for one significant difference and that is this file right here GameScene.sks. Sks is short for SpriteKit scene. And if you click on that you're just going to see a blank-grey background. So through this course we're going to look at how to lay out a SpriteKit scene and what these files can do. And so just with this basic prototype I want to test the applications simulator and take a look at what the default file template does for SpriteKit.
So I'm going to change the device to iPhone 6s and then click the run button to run the app in the simulator. So we run the app. We see Hello, World! And we're not seeing that in that sks file because Hello, World! is actually generated with code. So we'll look at how that works later on when we browse through the template file. You can also click or tap, if you actually have a device, to spawn these little ships on the screen. And there they are. So that is our default file template and our SpriteKit code is actually running in the simulator right now.
If you're wondering why the simulator is extra small on my screen. That's because I've gone to Windows Scale and changed the scale to 50% so that it will fit on my screen while recording. So that's it. SpriteKit is now working and we've successfully created a SpriteKit project.
- 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