Book Image

Creating Games with cocos2d for iPhone 2

By : Paul Nygard
Book Image

Creating Games with cocos2d for iPhone 2

By: Paul Nygard

Overview of this book

Cocos2d for iPhone is a simple (but powerful) 2D framework that makes it easy to create games for the iPhone. There are thousands of games in the App Store already using cocos2d. Game development has never been this approachable and easy to get started. "Creating Games with cocos2d for iPhone 2" takes you through the entire process of designing and building nine complete games for the iPhone, iPod Touch, or iPad using cocos2d 2.0. The projects start simply and gradually increase in complexity, building on the lessons learned in previous chapters. Good design practices are emphasized throughout. From a simple match game to an endless runner, you will learn how to build a wide variety of game styles. You will learn how to implement animation, actions, create "artificial randomness", use the Box2D physics engine, create tile maps, and even use Bluetooth to play between two devices. "Creating games with cocos2d for iPhone 2" will take your game building skills to the next level.
Table of Contents (16 chapters)
Creating Games with cocos2d for iPhone 2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Design review


When you are designing a side-scrolling endless runner, there are two primary design approaches. Some will use a physics engine like Box2D or Chipmunk to help control all of the object interactions. We will be taking the other approach by building our own lightweight physics engine for the game. All of our ground will use square tiles, so we can easily identify the surfaces our hero can walk on safely. We will build sensors on the top of all walkable surfaces, as well as building sensors underneath each of our walking characters (hero and enemies). The hero will be in a fixed x coordinate on the screen, and the world will scroll past the hero. We will have two types of enemies: flying and walking. Both will have similar behavior, but the walkers will have the sensors we mentioned to allow them to walk back and forth on their platforms. Enemies will not be allowed to walk off the platforms to their death. We will also implement a two level endless parallax background from scratch...