不能这样使用getComponent得到sprite么?
另外发帖的时候为什么总是提示title无效,请描述的尽量详尽些?要多详尽?
或者要引用相同node下的sprite进行操作的话应该怎么搞?
请用 this.getComponent(cc.Sprite) 或者 this.getComponent(“cc.Sprite”)
多谢, 根据Node的API文档(rotation)为什么像下面这样设置旋转sprite没有旋转起来?
cc.Class({
extends: cc.Component,
properties: {
},
// use this for initialization
onLoad: function () {
},
// called every frame, uncomment this function to activate update callback
update: function (dt) {
this.rotation += 45;
this.rotation %= 360;
console.log(this.rotation);
},
});
console.log 一直打印 NaN?
脚本是组件,要旋转的是节点:
this.node.rotation += 45;
this.node.rotation %= 360;
console.log(this.node.rotation);
恩,多谢