cocos2d is a powerful framework that is used to power countless games for iOS – the purpose of this article is to get you up and running with the cocos2d templates and get them installed on Xcode 4.
Before we begin, you must have Xcode and Apple’s developer tools actually installed – to install Xcode, simply head over to the Mac App Store and search for Xcode and then install and run the app and you’ll be ready to go!
1. Go to cocos2d’s download page and download the most recent stable version of cocos2d to your computer.
2. Once the download has finished, extract the contents of the ZIP file and move the new folder to your Desktop and rename the folder to ‘cocos2d’.
3. Open up Terminal (Applications – Utilities – Terminal) and type in the following:
Although instead of putting ‘daniel’ put the short name of the account you’re using.
4. Now, once you’re pointed Terminal in the direction of the cocos2d folder, we are now going to run the installation file so ensure that Xcode is not open and type the following into Terminal:
You should find that Terminal opens and run the installation files for you and the final thing that Terminal says should be ‘done!’. Sure enough, this means that everything went well and it should be installed.
5. Now, we’re going to verify that we’ve actually installed the templates correctly, to do this open up Xcode and create a New Project (CMD + Shift + N) and then when the New Project Template dialogue appears, you should see cocos2d in the sidebar ready for you to make use of.
6. You’ll find that there’s three templates installed, each has it’s own purpose and use so choose wisely.
7. If you choose the basic first cocos2d template and open the project and then run the application you’ll also find that conveniently, cocos2d has created a basic, simple, functional iPhone app for you!
That concludes this tutorial, the purpose of this was to help you get started with cocos2d and installing the templates, you can now go on to conquering the world of iOS game development.