Book Image

Cocos2d for iPhone 0.99 Beginner's Guide

By : Pablo Ruiz
Book Image

Cocos2d for iPhone 0.99 Beginner's Guide

By: Pablo Ruiz

Overview of this book

<p>Cocos2d for iPhone is a robust but simple-to-use 2D game framework for iPhone. If you are just starting with game programming, cocos2d will enable you to make your first game in no time. Even if you are a seasoned game developer, you will still be able to benefit from what it offers. Yet beginning with cocos2d for iPhone may be an arduous task without a proper guide.</p> <p><i>Cocos2d for iPhone 0.99 Beginner</i>&rsquo;s Guide will help you to learn how to make games with cocos2d from the ground up. You will learn all the key concepts of the framework and game programming in general while building your first game using this exciting platform.</p> <p>You will start by learning the basics of cocos2d then you will learn how to enhance your game with a lot of cool features and eye candy. After spending a little time learning the basics, you will jump straight into action. The book will then teach you to build games from scratch and how to add animations, sounds, and particle effects to them. Then you will be guided to have your game behave as in real life by using a physics engine. After reading <i>Cocos2d for iPhone 0.99 Beginner's Guide</i>, you will be able to write your own games for iPhone while using all the elements Pros use. There are a lot of examples, images, and diagrams to get you up to speed in no time.</p>
Table of Contents (18 chapters)
Cocos2d for iPhone 0.99 Beginner's Guide
Credits
About the Author
About the Reviewers
Preface
Index

Time for action –taking a look at the Chipmunk template


As we saw, back in the first chapter, Cocos2d includes three templates for you to start a project. The regular template that creates a layer and includes the Cocos2d files for you, and two other templates; one includes the necessary files to use Box2D and the other one includes the necessary files to use Chipmunk within your game.

Let's create a new project from the Chipmunk template to see what happens, as follows:

  1. Go to File | New Project and search for the Cocos2d Chipmunk application template.

  2. Name the new project TotemBalance.

  3. Once the project is created, run it. Play a little with it. As you can see, the sprite onscreen will fall depending on how you tilt your device. Also by tapping on the screen, you can add more sprites and see how they behave when they collide.

What just happened?

We have just tried the Cocos2d + Chipmunk template. Let's take a look at what it does now.

There are a few steps you have to go over in order to be...