好多的书籍都是webStorm+cocos2d-x来写的.
但是按书上写的总是出现莫名奇妙的错误.

代码如下
main.js
//load resources
cc.LoaderScene.preload(g_resources, function () {
cc.director.runScene(new HelloWorldScene());
}, this);
app.js
var HelloWorldScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new BackGroundLayer();
this.addChild(layer);
}
});
Background.js
var BackGroundLayer = cc.Layer.extend({
ctor : function() {
this._super();
var size = cc.winSize;
var sprite1 = new cc.sprite(res.HelloWorld_png);
sprite1.attr({
x : size.width / 2,
y : size.height / 2
});
this.addChild(sprite1);
return true;
}
});
感觉要崩溃了!