Snake Game Using Cocos2d-x Javascript Desktop - PART 5

Datetime:2016-08-23 04:29:56         Topic: Cocos2d-X  JavaScript          Share        Original >>
Here to See The Original Article!!!

Now that the game coding is done we can use the same code base almost without change for our game desktop version.

To run the main.js file which is the game entry point we need to compile Cocos2d-x RunTime which will load our game.

for this we use:

  1. Visual studio 2013 c++  community version . 
  2. The same code base we created in  Snake Game Using Cocos2d-x HTML5 - PART 1  .

1. Open VC++   then go to FILE -> Open -> Project/Solution . and navigate to where you created the SnakeJS project .  then navigate to deeper directory named:   proj.win32 :

\cocos2d-x-3.8.1\Projects\SnakeJS\ frameworks\runtime-src\proj.win32

And load the "SnakeJS" VC++ solution project called  SnakeJS.sln .|

2. Once we done loading the Cocose2d-x Runtime source code into VC++ we ready to compile it.

we don't need Debug version for this example because for now we are not going to change any c++ source code ,

In VC++ :

  1. in the projects list on the right select our "SnakeJS" project . 
  2. go to the upper tool box there is drop down list with "Debug" selected . change it to " Release "

3. In VC++ which SnakeJS project selected go to and click on : BUILD -> Build SnakeJS

Wait until it is done to compile.

When it is done to compile. you should see in the VC++ bottom Output window scroll to the end .

7>  4 File(s) copied
7>          1 file(s) copied.
7>          1 file(s) copied.
========== Build: 7 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

4. Now we are ready to start our WindTakeFS game Navigate to :


look for  SnakeJS.exe click it to execute the game .

And your game should look like this :

We are ready to build our "SnakeJS" game for iOS the next tutorial :

Snake Game Using Cocos2d-x Javascript iOS- PART 6  

Play the final SnakeJS game:

The SnakeJS source code:


Put your ads here, just $200 per month.