in books

My Cocos2D Book Published Today

Cocos2D Book

I’m very excited to announce that my book Learning iPhone Game Development with Cocos2D 3.0 is finally published!

As you can see the final name of the book changed a little and it is now called Learning iPhone Game Development with Cocos2D 3.0.

I’ve been working on this book for more than 7 months and I’m finally happy with the result. I hope you will like the book and it will help you start making games for iOS using Cocos2D v3.

Aim of This Book

The aim of this book is to be an easy-to-follow, step-by-step beginner’s guide covering the full process of creating a game. It is packed with examples and illustrations, with comprehensive coverage of each topic.

In other words, this Cocos2D Book is for anyone who wants to learn how to make games with Cocos2D-Swift.

In case you’ve missed, Cocos2D-Swift is a new name of the good old Cocos2D-iPhone open-source framework. I will just call it Cocos2D for brevity.

The book is written mostly for beginner developers who have little to no experience with Cocos2D. So all you need to start making games is a Mac running OS X 10.8.4 (Mountain Lion) and this book of course :)

What You Will Learn from This Cocos2D Book

In this book I tried to answer questions that arise when you first start making games using Cocos2D.

Such questions as:

  • How to install Cocos2D
  • How to create your first project
  • How to add and animate sprites
  • How to write game logic, add states, wining and loosing conditions
  • How to get user input, handle touches, use gyroscope
  • How to play sound and music, turn it on and off
  • How to use physics engine in your games
  • How to create convenient user interface

And so on…


I believe that the best way of learning game development is making games!

This is why we will spend most of the time working on different aspects of the game creation process and solving tasks that you will most likely face when will be working on your games.

However, creating different separate parts of the game will not teach you how to create completed games. This is why instead of creating lots of mini-games and running short code snippets we will work on creating a completed game.

At the end of the book we will complete all steps of game development process and will have an almost completed game on our hands. With just a little polishing this is what you can safely submit to the App Store.

And I actually did this, please find a link below!


I’ve gathered some links that will help you get a better understanding of what you can expect in this Coocs2D book.

Official page at Packt website
Here you can purchase the book, see official table of contents, download free sample chapter and files that come with the book (source code, game art, …).

Github Repository
As an alternative to downloading book’s supporting files as a single archive from the Packt website you can browse them on Github.

YouTube Video
I’ve prepared a short YouTube video demonstrating some of the game we will create during the course of this Cocos2D book.

Game in the App Store
Using the above link you can find a slightly polished version of the game we will work on.

I had to polish this version (e.g. add some dialogs to restart the game) so that the app wasn’t rejected by Apple. However, the App Store version is 95% identical to the game you will created during the course of the book.

Cocos2D Book

Illustrations Examples

A picture is worth a thousand words. This is why I tried to include as many illustrations as I could possibly fit in a book.

Here are some examples:

Cocos2D Book: Anchor Point

Explaining rotation around anchor point.

Cocos2D Book: Applying Impulse

Applying impulse using Chipmunk physics engine.

Cocos2D Book: Complicated CCActionSequence

Diagram of complicated actions sequence (CCActionSequence).

Chapters List

Here is a list of chapters that you will find in this Cocos2D Book:

Chapter 1, All About Cocos2D

This is a short overview chapter. It provides some basic information about game engines in general, some additional information about Cocos2D, as well as examples of great games created with Cocos2D.

Chapter 2, Installing Cocos2D

In this chapter we will install Cocos2D v3, create our first project and write some code. In addition, we will review the contents of the Cocos2D distribution package and will run some demo projects that come with Cocos2D.

Chapter 3, Cocos2D – Under the Hood

This chapter provides bird’s-eye overview of the Cocos2D architecture, its main classes and configuration options. It is the only chapter where we won’t write a single line of code. However, after reading this chapter it will be much easier to understand why things work the way they are and proceed to the practical part of the book.

Chapter 4, Rendering Sprites

In this chapter, we will create a game project that we’ll be working on in following chapters. We will create a game scene, add background image, player and enemy characters. We will review some of the main properties of Cocos2D nodes and will make them move, rotate, flip, and so on.

Chapter 5, Starting the Action

After adding all main game objects to the game it is time to learn how to write game logic and control the game flow using states. To let the player control the game we will learn how to get user input by handling touches or using iPhone’s gyroscope. At the end of this chapter we will have a skeleton of a playable game.

Chapter 6, Rendering Text

This chapter shows how to display score, lives, earned points, and winning and losing labels. In this chapter, we will use both True Type and Bitmap font labels of Cosos2D and will discuss benefits and performance of each label type.

Chapter 7, Animations and Particle Systems

In fact we will use animations earlier in the book, before getting to this chapter. However, in this chapter we will review different animation types in detail, discuss pros and cons and when should you use specific animation type.

In the second part of this chapter we will use particle systems to get really cool effects such as explosions and fire.

Chapter 8, Adding Sound Effects and Music

In this chapter we will add sound effects and music, will learn how to switch between music tracks and adjust audio properties.

Chapter 9, User Interface and Navigation

At the start of this chapter we’ll have a playable game level. However, no game consists of just one game level. In this chapter we will concentrate on creating a convenient user interface using Cocos2D controls, such as buttons, scroll view, table view, and so on. We will see how to create scenes that exist in most games, such as menu scene, about scene, highscores, and so on, and how to navigate between them.

Chapter 10, Physics

This chapter shows how to use Chipmunk physics engine in your games. In this chapter, we will create a playable level using the physics engine; we will review how to setup physics node, create physics objects, adjust their properties, detect and filter collisions, use joints, and so on.

Chapter 11, Tile Maps

This chapter provides a brief introduction in using tile maps in your games. It explains what is tile map, shows the complete process of creating tile map using set of images and of course loading and using a tile map in the game. In addition we’ll see how we can create parallax scrolling using different tile maps layers.

Chapter 12, Standing Out – Integrating Game Center and In-App Purchases

The final chapter covers the process of integrating Game Center and adding In-App purchases to the game.

Any Questions?

If you have any questions or comments please leave them below or ask them on the book’s offical forum.

Write a Comment



  1. I have a subscription to Safari Online and I stumbled across your book. I have never done any iOS development and I just liked the look of trying. I have to say that your book is fantastic!! :) :) The game development steps are very straightforward! I am not great with Objective C, so some of the syntax is a little unknown to me, but this does not stop me from loving this book. A great insight into how to write a game by actually making one! :)
    Well done on such a fantastic publication and thank you for making it all feel so easy! :)

    • Thank you for your comment! It is great to hear that you find the book easy to follow, because this is exactly what I was aiming for when writing it. If you can rate it on Safari Online website I would be thankful, since there are no ratings right now (Amazon version has already 8 ratings).

      • I looked at the Safari Online website, and I do not see anywhere to leave a rating! :( If you are familiar with the site, please let me know and I will be happy to rate the book. :)

  2. Hi,

    I have just got to the end of the book, well almost. I cannot seem to get access to chapter 12. When I visit the Packt site for download I only get the code for the chapters, including chapter 12′s code. However I do not get any additional written information.
    Can you advise on how I best go about getting this last chapter?

    I just wanted to thank you again for writing this book; it has been really fun to write the relatively small bits of code and to see the frameworks of a range of game techniques unfold before my eyes. :)

    I would greatly appreciate any recommendations that you may have on other books or sources that you would recommend.

    Wishing you a great day.

    • Hi!

      I’m glad you like the book!

      First of all here is the link to Chapter 12:

      It looks like Packt changed design of their website and I also can’t find a link to download the chapter. I’ll contact them about this. However, there should be a URL in the book’s preface, but I know that none reads that :)

      Anyway, please use the link above to get Chapter 12.

      Regarding books and other resources. I would recommend you to try to create at least few simple games and maybe submit them to App Store or at least show to your friends, family or on some forum. While working on those games you will face some real world tasks. Just google those, ask on forums and solve them as you go. I think this is the best way to learn game development after you’ve learned the basics.

      When you feel yourself comfortable with basic stuff just read some forums, online tutorials, general development books (design patterns, algorithms,…) and don’t forget to actually write code :)

      Have a great day too!