Cocos Creator的类别

cc是命名空间;cocos creater引擎下的类得加cc; 如cc.Node cc.v2;

1).cc.Component组件类
onLoad
start
update
lateUpdate
onDestroy
onEnable
onDisable

2)cc.Node
var node = new cc.Node('dfdf'); //创建
var node = cc.instantiate(this.target); //克隆
this.target.destroy(); //销毁节点并不会立刻被移除,而是在当前帧逻辑更新结束后,统一执行
this.target.removeFromParent(false); //它不一定就能完全从内存中释放

3).组件与子节点:
组件只是添加到节点里的属性;用this.getComponent(cc.Button) 获取
子节点是节点;用this.node.getChildByName(“yy”); 获取
cc.find(“yy”); 任何位置查找节点

4)cc.director 场景切换加载
cc.director.loadScene("MyScene");
cc.director.preloadScene("table", function () {
cc.log("Next scene preloaded");
});

原文地址:https://www.cnblogs.com/luorende/p/9105270.html