cocos 按钮再次点击设置位置无效

问题描述

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
 }
阅读 1.6k
1 个回答
新手上路,请多包涵

你是不是添加了 widget

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题