cocos creator基础-初识cocos、cocos基本组件和事件

 1 cc.Class({
 2     extends : cc.Compoment,
 3 
 4     properties : {
 5         num : 0, // cc.Interger
 6         string : '', //cc.String
 7         bool : false, //cc.Boolean
 8         array: [cc.Integer],
 9 
10         myNode : cc.Node,
11         //myComponent : cc.Component,
12         boxCollider : cc.BoxCollider,
13         circleCollider : cc.CircleCollider,
14         polygonCollider : cc.PolygonCollider,
15 
16         animation : cc.Animation,
17         audioSource : cc.AudioSource,
18         motionStreak : cc.MotionStreak,
19 
20         sprite : cc.Sprite,
21         labe : cc.Label,
22 
23         custom : require('script-name'),
24 
25         button : cc.Button,
26 
27         _private : 5, // 带_的是私有变量,不在面板显示 用get set方法
28         public : {
29             type : cc.Integer,
30             visible : function(){
31                 return !!this._private;
32             },
33             get: function(){return this._private;},
34             set: function(value){this._private = value;},
35         },
36         complexPorp : {
37 
38         },
39     },
40     
41     onLoad : function(){ // 脚本加载时调用
42 
43     },
44 
45     start : function(){ // 在所有文件的onLoad调用完之后调用
46 
47     },
48 
49     onEnable : function(){ // 组件活动的时候调用
50 
51     },
52 
53     onDisable : function(){ // 组件睡眠时候调用
54 
55     },
56 
57     onDestroy : function(){ //组件销毁时
58 
59     },
60 
61     update : function(dt){ // 组件正在活动时,每1/60秒调用一次update
62 
63     },
64 
65     lateUpdate : function(dt){ // 组件正在活动时,在所有组件的update调用完成之后调用
66 
67     }
68 });
69 
70 // cocos层级遮挡关系,层级管理器越靠上的越先渲染,就越容易被其他物体遮挡

 

组件化的开发模式:
(1)先有数据节点
(2)给数据节点添加组件,赋予节点对象不同的功能;
(3)组件可从用,开发模式比较统一;

 

1: 创建步骤;
2: 编辑器窗口分类;
3: creator的典型的偏好设置;
4: creator项目文件与规范化的管理;
5: creator项目的版本控制;
6: creator项目的.meta文件
7: 标准场景的根节点;
8: cc.Node 节点组件 ;
9: cc.Canvas组件;
10: creator安装目录;
11: creator打包发布;
12: 为什么creator能发不出来 h5, android, iOS的安装包;
13: 为什么要用js, 不用lua, c/c++ 开发;
14: creator文档;
16: creator模拟器所在的位置;

 

项目资源目录
Assets
  res
    map
    data
  resources 代码加载的资源目录,资源全放在此目录,会导致打包后的setting.js文件特别大, 不推荐
  scenes
  scripts

.mata文件
  每一个资源的管理文件
  文件uuid(引擎识别用),保存一些文件特有的属性,
  直接替换.mata文件对应的图片资源,不会导致资源引用的丢失,但是如果uuid改变,引用会 丢失

.gitignore
  提交时候的忽略文件

posted @ 2019-01-21 18:23  orxx  阅读(1259)  评论(0编辑  收藏  举报