Monday, August 12, 2013

Create a multi-plaform cocos2d-x 3.0 project

Step 1 - Download cocos2d-x

Download your cocos2d-x directory
As a pre step 1 I would uninstall some of the previous version of the cocos2d Xcode templates by following this stackoverflow post.

Step 2 - Download & Install Python

Since the script "cocos2d-x/" is a python script. You will need to download and install Python 2.7. Skip to Step 3 if you have already downloaded and installed Python. After you've downloaded your python-2.7-macosx10.6.dmg. Open it up and double click on "Python.mpkg". I use Pacifist to install the multiple package file. Python will be installed at the "/usr/local/bin" directory by default. Be sure that directory is in your environment search PATH.

Step 3 - Run the Cocos2d-x create script

Go into your Cocos2d-x directory and run the script below. Be sure to replace the project name and your project identifier to your own. I'm assuming that you are creating a C++ project, thus "cpp".

cd cocos2d-x
python ./ -p [ProjectName] -k [com.project.myproject] -l cpp

Step 4 - Open up your project

Your iOS Xcode project is now located at "cocos2d-x/projects/[ProjectName]/proj.ios"

Reference: How_to_create_a_multi-platform_project_in_one_command_line


  1. Hi, i am using windows. so I should download this Python 2.7.5 Windows Installer (Windows binary -- does not include source) - right?

    2nd question. on step 3, it says to run the script. Should i enter those lines in a CMD promt?

    3rd question. is there a way for me to download the python offline?


    1. Yes, install Python for windows and you will need to run that script with the python executable.

  2. i have installed python for windows and had run the command prompt of it.
    I entered

    cd cocos2d-x

    on the first line based on the instructions. however i got an error invalid syntax and an arrow point to the letter "d" of what i have entered. sorry havent used python before.

  3. Ty for the help mate, everything working now.... Just wondering why we can't install the templates at the xcode... Anyway, thanks!