cocos2d-js传参有很多种方式,全局变量是最容易想到的。我们现在利用另外一种方式:
//添加一个layer
var layer = new HelloWorldLayer(100)
this.addChild(layer)
var HelloWorldLayer = cc.Layer.extend({
ctor:function (testNum) {
cc.log("get the number:", testNum)
);
}
)};
//添加一个layer
var layer = new HelloWorldLayer(100)
this.addChild(layer)
var HelloWorldLayer = cc.Layer.extend({
ctor:function (testNum) {
cc.log("get the number:", testNum)
);
}
)};