Book Image

Getting Started with SpriteKit

By : Jorge Jordán
Book Image

Getting Started with SpriteKit

By: Jorge Jordán

Overview of this book

SpriteKit is Apple’s game engine to develop native iOS games. Strongly boosted by the Apple Inc., Cupertino, it has increased in popularity since its first release. This book shows you the solutions provided by SpriteKit to help you create any 2D game you can imagine and apply them to create animations that will highlight your existing apps. This book will give you the knowledge you need to apply SpriteKit to your existing apps or create your own games from scratch. Throughout the book, you will develop a complete game. The beautiful designs implemented in the game in this book will easily lead you to learn the basis of 2D game development, including creating and moving sprites, and adding them to a game scene. You will also discover how to apply advanced techniques such as collision detection, action execution, playing music, or running animations to give a more professional aspect to the game. You will finish your first game by learning how to add a main menu and a tutorial, as well as saving and loading data from and to the player’s device. Finally, you will find out how to apply some mobile games techniques such as accelerometer use or touch detection.
Table of Contents (13 chapters)
Getting Started with SpriteKit
About the Author
About the Reviewer

Using the accelerometer

One of the best technological advances brought by mobile devices is the accelerometer, which is a hardware mechanism that provides the capability of measuring the G-force acceleration on the x, y, and z coordinates.

This technology opened a wide field of new types of games and helped modernize some existing genres. We are going to utilize it to provide a new way to control the rabbit's movement.

In order to start receiving information from the accelerometer, we are going to import a new framework to our project. But first of all, let's open the initial project for this chapter, which is similar to the one that we left at the end of the previous chapter, by performing the following steps:

  1. Unzip, where you will find Unzip it too and open the project with Xcode.

  2. If you take a look to its contents, you will see that we are not using the plist file information anymore to load the door's distribution.

Now that we have the basis of...