g
Printer Friendly Version

editor  
BellaOnline's Digital Art and Design Editor
 

Installing Cocos2d

Now that you have Xcode 3 installed, we can install Cocos2D which is a free, open source physics engine for Xcode. It's great for iOS apps for several reasons. It is written in Objective C and supports OpenGL ES, iPod Touch, iPhone, iPad and Mac. It supports both Box2d and Chipmunk.

I suggest that you use the same version of Cocos2D that your book is using. Like Xcode there is a lag between the most current release of Cocos2D and what you find discussed in the latest books. For Xcode 3, this will probably be cocos2d-iphone-0.99.5. Download the .tar.gz file from the Cocos2D-iPhone.org website. Click on this file and you will get an archive folder on your desktop. Open this folder and find the install-templates.sh file.

We will use the Ternimal.app to install the Cocos2D templates. Again I am assuming that you do not have any Cocos2d files install already. From your Applications folder on the Dock, go to the Utilities folder and open the Terminal.app. The first step is to tell Terminal where to find the file we want to install. After the $ in the Terminal dialog box, type "cd" and follow it with the path to the cocos2d folder. Click Return.

cd /Users/xxxxxxx/Desktop/cocos2d-iphone-0.99.5/

You should see a new line in the Terminal dialog box displaying the path to the folder. After the $, type the following to start the install.

./install-templates.sh -u.

Terminal will ask for your password. As you type in your password the cursor will not move. Don't worry, just type in your password and click Return. The installation will start and you will see a list of files. When you see "Done!" you can close the Terminal dialog box. The Cocos2D files are install.

Let's open Xcode and start a new project to see if we have Cocos2D installed. In the New Project dialog box you will see a new tab called User Templates in the left menu. Under this tab we see the Cocos2d 0.99.5 is listed. In the right panel, we have several icons.

  • cocos2d Application - template for cocos2d for iOS
  • cocos2d Application - Mac - template for cocos2d for Mac
  • cocos2d Box2d Application - cocos2d iOS and Box2d
  • cocos2d Chipmunk Application - cocos2d iOS and Chipmunk
As you can see, we can use three of these templates for iOS projects. The first is a generic project template and the other two have the basic supporting files for the Box2d and Chipmunk physics engines.

Let's test the cocos2d-Application template. Choose this template and Click Choose. The new project will display in the Xcode workspace and you should see a few new folders for this project. From the Simulator drop-down menu, choose iPad Simulator 4.2 not 4.3. Click the Build and Run button.

You can delete the cocos2d-iphone-0.99.5 folder and tar.gz files from your desktop.



|
Join us in the Flash forum. | Join us in the Digital Art and Design forum.

Digital Art and Design Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor