HTML and CSS Reference
In-Depth Information
Figure 24-11. Cocos2d template structure
build.xml file is used for the Google closure compiler. You can use this file to package all
of your game and engine files into a single file.
The
Cocos2d-jsb.js file is the entry file for the JSB project.
The
Cocos2d.js file is the entry file of index.html . It defines project configuration, such as
render mode, debug mode, frame rate, and so forth. You also need to add the user's game
JavaScript files list to the file.
The
index.html file is the entry file of your project. It defines the canvas div that you will
use in your game, viewport setting, full screen setting, and so on. Note that this HTML page
references only one JavaScript file ( Cocos2d.js ).
The
main.js file initializes the game setting, sets different resolution resources for the search
path, initializes the multi-resolution adaption, and launches the game.
The
res directory contains all of your resources, including images, sounds, background music,
and configuration files. You can put different resolution resources in different subdirectories
and set the corresponding path in main.js .
The
src directory includes all of the JavaScript files used in the game. The resource.js file
defines all of the resources used in the game. In addition, you can separate your resources into
different groups and preload them on demand.
The
Building the Tower Defence Game
In this section, you will start to create a tower defence game step by step based on Cocos2d-html5. I will also cover
deploying the game to the web server and packaging all JavaScript files into a obfuscated single file for security.
Overview
Before coding, take a look at the overview of the game and then dive into its component details to learn its features.
 
Search WWH ::




Custom Search