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:
- Visual studio 2013 c++ community version .
- 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 :
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++ :
- in the projects list on the right select our "SnakeJS" project .
- 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 :
Play the final SnakeJS game:
The SnakeJS source code:https://github.com/meiry/SnakeJS-html5