Explore the Default Template

The default iOS Game template includes some default files like AppDelegate.swift and Main.storyboard. If you’ve built other iOS apps before, you may recognize both of these files. The AppDelegate.swift file handles application lifecycle events,[18] and the Main.storyboard file contains the main view controller.

The default template also includes files specific to SpriteKit, like Actions.sks and GameScene.sks. Most of the time, you’ll replace or modify these two files; however, using a template is preferred as it saves time in the long run.

Before you get too far into developing your first game with SpriteKit, build and run the default project to ensure everything is working. Start by setting the destination for the active scheme to the iPhone 11 Pro Max. To select the destination, click the currently selected destination on the Scheme menu located to the right of the active scheme, and choose the iPhone 11 Pro Max from the list of available destinations, like so:

images/CreatingScenesWithSpritesAndNodes/spritekit-active-scheme-callouts.png

Once you’ve set the active scheme destination, build and run the project by selecting Product Run from Xcode’s App menu. Alternatively, you can use the Run button in the top-left corner of the Xcode toolbar (it looks like a play button).

When the Simulator app launches, you’ll see a screen with a dark-colored background and some light-colored text that reads, “Hello, World!”. When you click the screen, the text shrinks and expands, and some animated colored shapes appear.

images/CreatingScenesWithSpritesAndNodes/spritekit-build-00.png

What you’re seeing is the default SpriteKit project. This project uses a single scene and some relatively simple animations. Sure, it’s kind of neat, but this project doesn’t do much considering what’s possible with SpriteKit.

Rather than spending time working through the details of how the default scene was built, you’ll remove this scene and clean up the default template, getting it ready for the next step: building your game.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset