javascriptvisual-studio-2012cocos2d-html5

getting cocos2d-html5 to work with visual studio


<rant> I swear dealing with IDE problems are the worse. Its like all I want to do is get my hands dirty with some code but can't. </rant>

As the title suggest I am trying to get Cocos2d-HTML5 working in Visual Studio 2012. I have coppied the Cocos2d-HTML5 files to my web directory and followed a few of the tutorials but am having a problem with jsloader.js.

Prior to the change below it was not finding the jsloader.js :

   FROM:  `engineDir: '../cocos2d/',`
   TO:  `engineDir: '../GridWars/cocos2d/'`

Gridwars is the name of the project

Now it finds jsloader.js but has an error.

Unhandled exception at line 117, column 5 in http://localhost:51244/GridWars/cocos2d/platform/jsloader.js

0x800a138f - JavaScript runtime error: Unable to get property 'loadExtension' of undefined or null reference

for these lines of code:

var d = document;
var c = d.ccConfig;

if (c.loadExtension != null && c.loadExtension == true) {

Solution

  • The answer was posted on their release notes. I was following one of their tutorials and ended up finding my answer at the bottom of the post.

    ANSWER:

    in cocos2d.js

    look for "s.c = c",

    change it to "document.ccConfig = c"

    in main.js

    look for "config:document.querySelector('#cocos2d-html5')['c'],"

    change it to "config:document.ccConfig,"