Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


9. July 2012

 

I am a bit late to announce this ( like, almost 3 weeks late ), but cocos2D HTML has a new Cocos2dHTML5release.  You can read the complete release notes on their website, but there are a few changes that are of particular concern to the tutorials on this site.  Instead of going back an updating the tutorials ( for now at least ), I will show this quick updating guide in case you run into trouble getting them to run.  The changes on the whole are pretty minor.

 

 

So, if you want to update your code to run with alpha2, make the following changes.

 

 

 

MyFirstApp:

In MyFirstApp.js change:

var layer1 = cc.LayerColor.layerWithColorWidthHeight(cc.ccc4(255, 255, 0, 255), 600, 600);

To:

var layer1 = cc.LayerColor.create(cc.ccc4(255, 255, 0, 255), 600, 600);

 

var helloLabel = cc.LabelTTF.labelWithString("Hello world", "Arial", 30);

To:

var helloLabel = cc.LabelTTF.create("Hello world", "Arial", 30);

 

var scene = cc.Scene.node();

To:

var scene = cc.Scene.create();

 

 

MySecondApp:

 

In MySecondApp.js change:

var scene = cc.Scene.node();

To:

var scene = cc.Scene.create();

 

var layer1 = cc.LayerColor.layerWithColorWidthHeight( cc.ccc4(128, 128, 128, 255), 600, 600), jetSprite = cc.Sprite.spriteWithFile("./images/Jet.png");

To:

var layer1 = cc.LayerColor.create( cc.ccc4(128, 128, 128, 255), 600, 600), jetSprite = cc.Sprite.create("./images/Jet.png");

 

 

MyThirdApp:

 

In MyThirdApp.js change:

 

var scene = cc.Scene.node();

To:

var scene = cc.Scene.create();

 

 

 

 

And that’s it.  It sucks that breaking changes happen, but I think you will admit, this one is certainly for the better.   Any code from this point forward will use the newer SDK.

Programming

blog comments powered by Disqus

Month List

Popular Comments