Saturday, October 3, 2015

Snake Game Using Cocos2d-x HTML5 - PART 4

In this final tutorial we going to minify all this gigantic cocos2d-x javascript + html framework
To 1 small JavaScript file.
To do this magic we should go back to when we setup the Cocos2d-x first.

1. When you run the python "setup.py" script it ask you to set the ANT_ROOT global variable value .as Shown here:





Once done , we are ready to minify our project , if you follow my tutorial :
Debug Cocos2d-x HTML5 Project using NetBeans IDE and Chrome browser in 10 easy steps.

2. So now it is the time to copy back the files to the cocos2d-x directory structure , in my pc it is under : cocos2d-x-3.8.1\cocos2d-x-3.8.1\Projects\SnakeJS




3. Open command line window in our SnakeJS root and type the following command :

1
cocos compile -p web -m release
4. The Final game should be in this directory :Projects\SnakeJS\publish\html5






 5. That's it ! you can run the game in your server using the good old index.html entry point .


We are ready to build our "SnakeJS" game for Windows desktop  the next tutorial :
Snake Game Using Cocos2d-x Javascript - PART 5 desktop

Play the final SnakeJS game :
http://meiry.github.io/SnakeJS-html5/publish/html5/
The SnakeJS source code:
https://github.com/meiry/SnakeJS-html5

1 comment:

Note: Only a member of this blog may post a comment.