当页面滚动时,Phaser 3游戏不滚动

时间:2019-11-13 12:35:58

标签: javascript angular phaser

我正在使用Phaser 3.18开发游戏,该游戏是angular应用程序的一部分(使用angular 8)。使用setInteractive()函数在游戏中创建了一些按钮。游戏和按钮可以正常工作。但是,在滚动页面时,按钮无法正常工作,即按钮的hitArea未更新。整个游戏会随着页面滚动,但是按钮的坐标不会更新。

创建的按钮代码:

  {
  "cartItem": {
    "sku": "fs-percentage",
    "qty": 1,
    "quote_id": "hzGPxZ3c0WWlkps33JfdgT2PRJeLI3oa",
    "product_type": "simple",
    "product_option": {
      "extension_attributes": {
        "custom_options": [
          {
            "option_id": "8",
            "option_value": 13
          },
          {
            "option_id": "8",
            "option_value": 14
          }
        ]
      }
    }
  }
}

Phaser游戏的配置功能:

var sprite = this.add.sprite(screen_width*0.5, screen_height*0.5, 'eye').setInteractive();
sprite.setScale(1.5);
sprite.on('pointerdown', function(event){
  console.log('here click working');
}); 

0 个答案:

没有答案