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


The design of this game is based on a decent sized tile map, 50 tiles wide and 50 tiles high. Our basic tile size (non-Retina) is 32 x 32 pixels. We will implement the tile map as a single scrolling layer, keeping our hero centered on the screen (except near the edges, but we'll get to that). The goal of the hero is to pick up three goal "signposts" scattered around the map. There will also be health power-ups on the map to restore the hero's health. We want to have two types of enemies. The first will move in a straight path toward the hero. The second type will be a little smarter. When they run into an impassable wall, we will use an A* Pathfinding algorithm to find a way around the wall, and then revert to the same straight line toward the hero logic. The player will be able to control the hero using either an on-screen joystick or tilt controls. With either method, there will be a fire button on-screen to shoot. We will break out our game into three layers for easier...