Book Image

iOS 7 Game Development

By : Dmitry Volevodz
Book Image

iOS 7 Game Development

By: Dmitry Volevodz

Overview of this book

<p>Sprite Kit, a new framework introduced in iOS7, has been designed as a built-in animation workflow for keyframing 2D animation without the need of engines such as Unity to serve as an intermediate. Sprite Kit enables the easy and fast development cycle, leaving more time to work on gameplay and polish, and less on tedious tasks.</p> <p>This book offers a practical approach to game development with the Sprite Kit framework of iOS7 platform, by creating an endless runner game. You will gain a full understanding of the new Apple framework along with tips and tricks to interact with the game either by detecting taps, using sophisticated gesture recognizers, and moving sprites by dragging.</p> <p>Starting with how to get your first sprite on screen, and then moving on to complicated physics and animations, we will be learning about the new features that iOS7provides for game development. You will also learn how to optimize your game performance, how to add animation files and create texture atlas in Xcode 5, and how to build different particles. By the end of the book you will learn how to create full featured endless runner game, with animations, sound effects and particle systems, how to post you application to the iTunes Appstore and about different application icons, categories, certificates, provisioning profiles, new Xcode publishing features and review process.</p> <p>This book will teach you everything you need to know to create your own powerful and immersive games.</p>
Table of Contents (14 chapters)
iOS 7 Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using gesture recognizers


Gesture recognizers allow us to not bother with the low-level code that was explained earlier in this chapter. Without gesture recognizers, certain things might be extremely hard to implement, such as pinching in and out or rotating. Thankfully, Apple has handled all of this for us.

We might want to increase and decrease the speed of scrolling for testing reasons, so we will implement this feature.

The first thing that comes to mind is adding a gesture recognizer to our scene, pointing it to some method, and be done with it. But unfortunately, this won't work—SKNodes and SKScenes do not support adding gesture recognizers. But there is a way to make this work.

SKScene has a handy method, (void)didMoveToView:(SKView *)view, which we can use, and it gets called each time a scene is about to be attached to some view. When we run our game, this happens right after the scene creation, and thus it is a useful place to set up our gesture recognizers. The following is the...