Browse by type

Cocos2d-JS is Cocos2d-x engine's JavaScript version that includes Cocos2d-html5 and Cocos2d-x JavaScript Bindings. It equips your game with cross-browser and cross-platform abilities, accompanied by full Cocos2d-x features and simplified JavaScript friendly APIs.
Cocos2d-JS reinvented workflows for all platforms in v3.0, it provides a consistent development experience for whichever platform you want to distribute to, no matter web and native. "Code once, run everywhere" is incredibly easy and natural in Cocos2d-JS. With one single JavaScript code base, you can run your game on all web browsers and native platforms including Mac OS, Windows, iOS and Android. This will bring your game great opportunities in almost all channels of distribution. On the other hand, if you are only interested in casual games on the web, you can embed directly in your web page the Cocos2d-JS Lite Version which is extremely easy to use and light as a feather.
Furthermore, JavaScript friendly APIs make your game development experience a breeze - easy to code, test and distribute. In the meantime, Cocos2d-JS v3.0 is super powerful along with all these cool new features: Editors Support, Assets Manager, Object Pool, JS to Objective-C/JAVA reflection, etc.
Cross platforms developers can use Cocos Console to create projects, boost their development with web version engine and deploy games onto all native platforms and all browsers with Cocos Console.
Casual web game developers can download the Lite Version and start to develop just like using other web frameworks (e.g. jQuery).

With any problems you might have, our communities are happy to help:
setup.pycocos scriptExample:
$ cd cocos2d-js
$ ./setup.py
$ source FILE_TO_SAVE_SYSTEM_VARIABLE
$ cocos new MyGame -l js -d /directory/to/project
$ cd /directory/to/project/MyGame
Run Cocos2d-html5 project with a Websever:
cocos run -p web
Compile and run project in Cocos2d-JSB :
cocos compile -p ios|mac|android|win32|web
cocos run -p ios|mac|android|win32|web
You may need to provide your Android NDK, Android SDK and ANT's paths during the setup. Note that this tool is developed with python, so you will need python (32bit) 2.7.5 or later installed on your machine (but it doesn't support Python3). Please refer to Cocos Console document.
And if you have any doubt about the usage, please use -h with any command to have some help messages.
You can also use prebuilt Xcode or Visual Studio projects which are located in Game/frameworks/runtime-src/proj.xxx
There are two prebuilt projects in Cocos2d-JS repo:
samples/js-testscd samples/js-tests
run -p ios|mac|android|win32|web
samples/js-moonwarriorscd samples/js-moonwarriors
run -p ios|mac|android|win32|web
And they share the same project files which are located in build folder, there are Xcode and Visual Studio projects.
For JSB build, there are some restrictions :
If you fork our github repository or download the package from github, you will need to do some extra tasks:
git submodule update --init --recursive in the cocos2d-js root folder, to init and update submodules recursively, such as cocos2dx/plugin.frameworks/js-bindings/cocos2d-x/download-deps.py to download external dependencies for Cocos2d-xtools/cocos2d-console/download-bin.py to download bin files for some cocos2d-console plugins like Google Closure Compiler and JSC Compiler.Otherwise, you will fail to compile your JSB projects.
$ claude mcp add cocos2d-js \
-- python -m otcore.mcp_server <graph>