cc.Class({
extends: cc.Component,
properties: {
score: 0,
player : {
hp: 100,
attack:10,
},
enemy : {
hp: 200,
attack:5,
},
},
后面的方法在调用 this.player.hp会报错,在用this.score没有问题
cc.Class({
extends: cc.Component,
properties: {
score: 0,
player : {
hp: 100,
attack:10,
},
enemy : {
hp: 200,
attack:5,
},
},
后面的方法在调用 this.player.hp会报错,在用this.score没有问题
你先看一遍官网关于脚本组建的教程再来发问吧。。。