大家好,新手求救,碰撞中的other问题.
这个other呢就是一个bullet.我设置了属性
cc.Class({
extends: cc.Component,
properties: {
power: 1,
},
然后在被碰撞的对象那里设置如下函数.
onCollisionEnter: function (other, self) {
this.node.y+=20;
if(other.tag==1)
{
this.node.x+=20;
life-= other.power;
this.node.x+=20;
if(life<=0)
{
die();
}
}
},
直接运行不行,other.power是错误的.
请问,如何获取other的power值呢.谢谢大家!