You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cocos2d-JS provides a console tool that makes the development of CH5 and JSB application more simpler and much convenient. You can use it to create a new project, publish it to android, iOS, Mac OS or web, and it's very easy to use.
6
5
7
-
##Setup
6
+
Cocos2d-JS is Cocos2d-x engine's javascript version which include Cocos2d-html5 and Cocos2d-x JSBinding. It support full Cocos2d-x features with a set of simplified javascript friendly APIs.
8
7
9
-
First step, you need to setup before using this tool. Please clone Cocos2d-JS repository and update all submodule. Open console in Cocos2d-JS folder, then just run `./setup.py` on console. You may need to provide your NDK, Android SDK and ANT's path 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).
8
+
Cocos2d-JS provides a consistent development experience for whichever platform you want to distribute to, both 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 both web browsers and native platform including Mac OS, Windows, iOS, Android. This will bring your game great opportunities in almost all canals of distribution.
10
9
11
-
Some useful links:
10
+
Furthermore, javascript friendly API makes your game development experience a breeze, easy to code, test and distribute. Cocos2d-JS also offers Cocos Console, a script tool, to simplify the creation of projects and let you start coding right away. You can use it to create a new project and publish it to android, iOS, Mac OS or web.
- Uncompress the downloaded file into a directory.
18
-
- Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH.
19
-
20
-
```
21
-
// Example: Execute in console or add into .bash_profile(Mac)
22
-
export ANT_HOME=/usr/local/ant
23
-
export JAVA_HOME=/usr/local/jdk1.7.0_51
24
-
export PATH=${PATH}:${ANT_HOME}/bin
25
-
```
12
+
## API Reference
26
13
27
-
##Usage
14
+
[Online API reference](http://www.cocos2d-x.org/reference/html5-js/V3.0alpha2/index.html)
28
15
29
-
After setup correctly done, you can start to use `cocos` command in your console.
* Create a project contains Cocos2d-x JSB and Cocos2d-html5:
21
+
1. Download the code from [Cocos2d download site](http://www.cocos2d-x.org/download)
22
+
2. Run `setup.py`
23
+
3. Run the `cocos` script
34
24
35
-
```
36
-
cocos new projectName -l js
37
-
```
25
+
Example:
38
26
39
-
* Create a project contains Cocos2d-html5 only:
27
+
$ cd cocos2d-js
28
+
$ ./setup.py
29
+
$ source FILE_TO_SAVE_SYSTEM_VARIABLE
30
+
31
+
$ cocos new MyGame -l js -d /directory/to/project
32
+
$ cd /directory/to/project/MyGame
33
+
34
+
40
35
41
-
```
42
-
cocos new projectName -l js --no-native
43
-
```
36
+
44
37
45
-
* Create a project in a specified directory:
46
38
47
-
```
48
-
cocos new projectName -l js -d ./Projects
49
-
```
50
39
51
-
###Run the project
40
+
###Run the project under the game directory
52
41
53
42
* Run Cocos2d-html5 project with a Websever:
54
43
55
44
```
56
-
cd directory/to/project
57
45
cocos run -p web
58
46
```
59
47
60
48
* Compile and run project in Cocos2d-JSB :
61
49
62
50
```
63
-
cd directory/to/project
64
51
cocos compile -p ios|mac|android|web
65
-
cocos run -p ios|mac|android
66
-
```
67
-
68
-
* Useful options
69
-
70
-
```
71
-
-p platform : The platform can be ios|mac|android|web.
72
-
-s source : Your project directory, if not specified the current directory will be used.
73
-
-q : Quiet mode, remove log messages.
74
-
-m mode : Mode debug or release, debug is default
75
-
--source-map: General source-map file. (Web platform only)
52
+
cocos run -p ios|mac|android|web
76
53
```
77
54
78
-
###Help
79
-
80
-
And if you have any doubt about the usage, please use `-h` with any command to have some help messages. Here are all three commands:
81
-
82
-
* `new` for create
83
-
* `compile` for compile
84
-
* `run` for run
55
+
You may need to provide your NDK, Android SDK and ANT's path 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](http://www.cocos2d-x.org/docs/manual/framework/html5/cocos-console/en).
56
+
57
+
And if you have any doubt about the usage, please use `-h` with any command to have some help messages.
58
+
59
+
###Built-in Projects
60
+
61
+
There are two prebuilt projects in Cocos2d-JS repo:
62
+
63
+
- Test cases, located in `samples/js-tests`
64
+
65
+
```
66
+
cd samples/js-tests
67
+
run -p ios|mac|android|web
68
+
```
69
+
- Game sample : Moon Warriors, located in `samples/js-moonwarriors`
70
+
71
+
```
72
+
cd samples/js-moonwarriors
73
+
run -p ios|mac|android|web
74
+
```
75
+
And they share the same project file which located in `build` folder, there are Xcode and Visual Studio projects.
76
+
77
+
Main features
78
+
-------------
79
+
* Support All modern browsers and native platforms
80
+
* Scene management (workflow)
81
+
* Transitions between scenes
82
+
* Sprites and Sprite Sheets
83
+
* Effects: Lens, Ripple, Waves, Liquid, etc.
84
+
* Actions (behaviours):
85
+
* Trasformation Actions: Move, Rotate, Scale, Fade, Tint, etc.
0 commit comments