Mike Fleischauer wrote:
Ok, all of the tutorials are updated to the newest API level. If you spot an error, please let me know.
Hopefully this is it for invasive changes, as that was a gigantic PITA!
Firstly, thank you for putting your time and efforts in writing tutorials for Cocos2d-html5.
I was the one who wrote the entry point code. so let me explain why I have done it that way.
Our requirement is that we need to
# pass advanced mode in google closure compiler
# smallest js loader file to load other/big js files
# Developer can easily identify the entry point, and change starting scene accordingly
and so, these files were born
- this file need to work for both “huge list of .js file” and “single packed obfuscated .js file”,
if we have packed and obfuscated the game code, we can modify this file, removing engineDir and user file list, and specify that onDOMready, load that file.
else if we are loading a big list of js file, then we will load another file called jsloader.js to handle that.
This file also contains some other configuration
- This file specifically load all the engine files in order then loads user files in order, if js files were packed into single file, then this file is reduntant
This also contains 2 methods to load js files to ensure that they loads in order. Only ie9 uses the slow method, which loads next file only when the first is loaded.
the fast method loads all file as same time, but execute when all have being loaded.
- This file was formally “appdelegate.js” which is a remnant of Cocos2d-iphone, which gets simulated in cocos2d-x, then we ported to js in alpha.
therefore, I moved this file to root, and renamed it to main.js, so it is much more visible.
Why can’t the starting scene be specified in cocos2d.js?
because scenes are not yet defined in cocos2d.js, using “strings” does not work for closure compiler
Main.js was formally appdelegate.js
after packing and obfuscation, there is no longer jsloader.js and main.js, just cocos2d.js
Lastly, we have pretty much finalized the API, keep in mind the same API is not only for cocos2d-html5, but for cocos2d-x and cocos2d-iphone as well with JS binding.
but i can rest assure you there won’t be more changes thats gonna be this invasive.