Tuesday, July 29, 2014

Using cocos to create a new project from scratch

cocos is a very useful command when creating a new Cocos2d-x project from scratch. However it has to be install before I can use it. But how? Due to the information on Cocos2d-x site were scatter around, I have overlook the very important piece where the manual did actually describe how it could be install. The article mention that I must first setup in order to use this tool by just run ./setup.py on console. This program can be found on Cocos2d-x root directory. I did it on Windows 8, and it works! After the setup, a new environment variable will be create on Windows. For my case, I'll see:

Variable name: COCOS_CONSOLE_ROOT
Variable value: D:\tool\cocos2d-x-3.2\tools\cocos2d-console\bin

And then I use following command to create a new project:

C:\Users\huahsin68>cocos new MyGame1 -p org.huahsin68.puzzle -l cpp -d D:\Cocos2
dxProject

Tada! A new game project is initialize for android, ios_mac, linux, win32, and wp8 platform.

No comments: