打开编辑器 ,新建了一个helloworld工程来熟悉一下啊
在 assets 下有个helloworld.fire文件,这是啥 没见过
琢磨了好久 才弄明白 这是个cocos creator的一个scene文件
再看看helloworld.js文件
cc.Class({
extends: cc.Component, --继承
properties: { --属性,也就是类似CPP中的成员变量
label: {
default: null,
type: cc.Label --类型 例如 cc.Node 都OK的
},
text: 'Hello, World!'
},
// use this for initialization
onLoad: function () { --初始化 估计如同init吧
this.label.string = this.text;
},
// called every frame
update: function (dt) {
},
});
短短的几行代码,分析下