Learn how to build 2D iPhone Games for Free!

Since SpriteBuilder is no longer maintained, this book is now available for free.

This book will teach you how to build iPhone games using the Open Source Tools SpriteBuilder and Cocos2D, and Apple's new programming language Swift.

You will learn the essentials of 2D graphics programming and dive into best practices of game programming while building a full iPhone game that is available on the App Store.

Get the book! (PDF, 263 Pages, Free!)or Read a sample chapter

Book Content

Chapter 1 - About this Book

This chapter discusses the structure of the book. It introduces different conventions and gives advice on how to get the most value out of the book.


Chapter 2 - Introduction to SpriteBuilder and Cocos2D

Throughout this chapter you will build a first very simple game and learn about essential Cocos2D, SpriteBuilder and general 2D game programming concepts such as scene graphs, code connections and bounding boxes.


Chapter 3 - Asset Handling and Basic Game Mechanics

In this chapter you will start building the "Falling Food!" game on which you will work throughout the rest of the book. Chapter 3 will teach you all about asset handling with SpriteBuilder and Cocos2D. Learn how to integrate sprites and audio assets into your games. You will also learn how to use the update loop to implement object movement.


Chapter 4 - User Interaction

Learn how to implement a drag and drop mechanism. You will also implement the core game mechanic of the game: catching objects. Since this game does not use the physics engine you will learn how to implement physical behaviour. You will also get to know details about Cocos2D’s touch handling API.


Chapter 5 - Scene Graphs, Node Transforms and State Machines

Learn how to incorporate a state machine into game development. You will also get to know details on affine transformations and how they are used to in Cocos2D to implement node hierarchies. Lastly you will learn about the rendering order in Cocos2D and how to use it to create a 3D feel in your 2D game.


Chapter 6 - User Interfaces and Implementing Multiple Game Modes modes

The largest chapter in the book. Learn how to implement a level select screen using a scroll view. Learn how to structure your game to support multiple game modes - without duplicating code. This chapter covers a variety of topics in UI programming and game programming patterns.


Chapter 7 - Persisting Highscores

A brief chapter that explains how to build a simple highscore system with NSUserDefaults.


Chapter 8 - Effects and Animations

Learn how to use the powerful CCEffects API to add lighting effects to your game! Dive deeper into SpriteBuilder's and Cocos2D's animation toolbox and polish the "Falling Food!" game.


Chapter 9 - Where to go from here?

This chapter wraps up your learning experience. Find out about additional resources on SpriteBuilder and Cocos2D.


Resources - Code and App Store link

The entire source code accompanying this book is available on GitHub. The final product of this book is available on the App Store.


Will this book be updated?

The SpriteBuilder tool that is taught throughout this book is unfortunately no longer maintained. Therefore I'm now offering this book for free. This also means that I won't make any further updates and not publish any new versions.

However, the entire source code for the book is available on GitHub. In the unlikely case that anyone is interested in submitting patches, I'm happy to release new versions.

Who is this book for?

This book is targeted towards developers of intermediate and advanced experience levels that want to learn how to develop 2D games for the iOS platform. This book doesn't assume any prior knowledge of game programming. It however does not teach programming from scratch! It also does not teach the basics of the Swift programming language, but you will be able to pick up the language as you proceed through the book. This book covers the most important features of SpriteBuilder and Cocos2D, except for the physics engine. If you are interested in building physics based games you should checkout this Make School tutorial and Steffen Itterheim's Learn SpriteBuilder Book.

About me

Hi! I'm Benjamin, the author of this book. I have four years of development experience on the iOS platform and two years of experience with Cocos2D.

I have written the original SpriteBuilder and Cocos2D documentation as well as many successful tutorials on makeschool.com. I regularly give talks on iOS development topics and love teaching passionate developers at Make School. You can find me on Twitter, my personal blog or simply reach out to me via email: me@benjamin-encz.de.