C ocos2d for iphone is a free, fast and lightweight framework for building 2d games for iPhone, iPad and iPod Touch. It is built in objective-c and makes incredibly easier the process of making games for iOS compared to use directly OpenGL.
Before we start the tutorial you need to know that you should have a Mac computer. Developing for iOS can only be done at Apple computers. You may also know that you need to join the Apple Developer Program (it’s free) to be able to download the iOS developer tools. It all can be done at http://developer.apple.com/devcenter/ios/program/.
With that said let’s get started.
First you need to download the latest version of Cocos2d at http://www.cocos2d-iphone.org/download. At the moment i’m writing this tutorial the latest version is 0.99.4.
Once downloaded, uncompress the file.
Open up Terminal and type cd.
Then drag the Cocos2d folder that you just uncompressed to the terminal window.
Your terminal command should look like this. If so hit return, else try again.
Now type ./install-templates.sh -u.
Hit return and your installation should start. If you did everything all right your window should look like this.
What we did with this was installing a project template for Xcode. Now when you open Xcode you can select the cocos2d option and start working right away in a cocos2d game without having to add the necessary files every time you start a new game project.
Open Xcode. Click “Create a new Xcode project.
In the left menu, select “cocos2d 0.99.4” at User Templates.
Click Choose and you are ready to start.
To learn more about Cocos2D i recommend you read this book:
In the next iPhone tutorials i’ll be explaining how Cocos2D works and i’ll show you some basic exercises. Stay tuned!.