Nazir Doğan Code Blog

Creating a New Cocos2d-js Project

| Comments

If you installed Cocos2d-js successfully. Now you can create a new project for developing Cocos2d-js game. if you dont install Cocos2d-js yet. Please follow this link.

I assume you installed  Cocos2d-js . and Now open your terminal and go Cocos2d-x directory

// Create a project containing Cocos2d-x JSB and Cocos2d-html5:
cocos new -l js

// Create a project only containing Cocos2d-html5:
cocos new -l js --no-native

// Create a project with a specified name in a specified directory:
cocos new projectName -l js -d ./Projects

Now you created Cocos2d-js project. Let's look how to run this project on Web Browser. When you prompt code below .it will start a web server and you can see game on  browser.

cd ~/Desktop/projectName
cocos run -p web

 

Screen Shot 2015-12-12 at 17.00.51

 

We successfully run our project on web browser.  Thats it :)

 

Comments