问题描述
cocos 按钮再次点击设置位置无效(this.startBtn.x = 3000),例子是官网上那个
相关代码
startGame: function () {
console.log('点击')
this.enabled = true
this.player.startMove(cc.v2(0, this.groundY))
// this.startBtn.active = false
this.startBtn.x = 3000 // 这里设置位置,使在视口李看不见按钮
console.log(this.startBtn)
},
gameOver: function () {
this.player.stopMove();
this.startBtn.x = 0 // 结束的时候将按钮还原在视口中
// this.startBtn.active = true
}
你是不是添加了 widget