CocosCreator
minatosan
这个作者很懒,什么都没留下…
展开
-
CocosCreator更改Label
脚本没有套在Label上时(一般也不会套在Label上…)一定要在 properties里写清楚是cc.Label(不能是cc.Node)不然会报错!!properties: {scoreLabel:cc.Label,},更改Labelthis.scoreLabel.string = “更改的字符串”;...原创 2020-04-09 02:55:47 · 3880 阅读 · 3 评论 -
Cocos Creator 创建Prefab资源代码
properties: { PrefabName:cc.Prefab, PrefabX:0, PrefabY:0, ... }函数 showPrefab(PrefabName,x,y){ var newItem = cc.instantiate(PrefabName); // 设置位置 newItem.se...原创 2020-04-23 21:37:01 · 2147 阅读 · 0 评论 -
Cocos Creator 获取组件宽高/坐标方法
属性【block可以是任何名称】cc.Class({ extends: cc.Component, properties: { block:cc.Node, ... }获取附着脚本的组件的宽高/坐标方法:(需要加Node)this.node.widththis.node.heightthis.node.xthis.no...原创 2020-04-20 01:03:29 · 3658 阅读 · 1 评论