COCOS-HTML5 First Knowledge

Source: Internet
Author: User

Cocos the construction of HTML5 project environment. According to the official website of the document. (Cocos HTML5, Webstorm, Google Chrome, Google store's Jet-brain plugin)

Can't wait to open the Cocos HTML5 file structure. Find chestnuts, Hellohtml5world, click Index.html, see the familiar picture ... (But it's a static one)

Use Web storm to import the entire HTML5 project.

The HTML5 program startup process is:

Index.html--Cocos2d.js. /cocos2d/jsloader.js-Main.js

Main.js Calling code:

var myApp = new Cocos2dapp (helloworldscene);

Into the src scene JS code, display the game interface.

When adding a new scene, "note" needs to declare the JS file created in Cocos2d.js's appfiles.

Write a better blog:

http://blog.csdn.net/honghaier/article/details/8642553

Cocos HTML5 tutorials, documentation, etc. on the official website.

________________________ Packing ___________________________

Since I wrote Cocos HTML5 's small Code section (image repeat vibration effect)

Decisively get the configured server (local can use Wamp, but I began to use local test, unexpectedly wamp not face hanging. Unknown cause (port or whatever). ) try it on.

Always do not know the project inside the role of the Build.xml file, it is the role of packaging export. With the ant command, execute the build.xml file.

The ant I use is apache-ant-1.9.4. Configure this ant command into the environment variable path.

cmd command line, enter the directory where the Build.xml file is located, enter Ant, execute.

Normal, will output compiled JS file (very large, my is 1240kB).

Next, modify some of the code in the Cocos2d.js file.

Deploy the project to the server. Very simple. You can run the Cocos HTML5 game by placing the four files in the red box below in the Web Access directory.

For example, put these four files in the server file directory, on the browser only need to do: www.****.com/index.html can see the effect of the operation!
Although the effect is the same as the development, but put on the server, it feels like ~ ~ ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.