properties: {
PrefabName:cc.Prefab,
PrefabX:0,
PrefabY:0,
...
}
函数
showPrefab(PrefabName,x,y){
var newItem = cc.instantiate(PrefabName);
// 设置位置
newItem.setPosition(x,y);
// 将新增的节点添加到 Canvas 节点下面
this.node.addChild(newItem);
return newItem;
},
调用
this.showPrefab(this.PrefabName,this.PrefabX,this.PrefabY);