【问题标题】:How to reload the game on Phaser 3?如何在 Phaser 3 上重新加载游戏?
【发布时间】:2019-10-16 11:28:46
【问题描述】:

点击按钮后如何重启游戏? 我尝试了以下代码:

this.scene.stop();
this.scene.start();

场景重新加载,但预加载功能再次失效。

【问题讨论】:

  • 为什么要再次运行预加载功能?您之前加载的资产应该仍然可以访问。
  • 您能与我们分享一个代码示例吗?或者你的 github 存储库,以便我们查看它?

标签: phaser-framework


【解决方案1】:

试试这个代码:

this.registry.destroy(); // destroy registry
this.events.off(); // disable all active events
this.scene.restart(); // restart current scene

还可以查看Phaser 3 Documentation 了解更多信息

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    • 2019-11-04
    • 2019-04-02
    • 2022-01-26
    • 2020-03-13
    • 1970-01-01
    相关资源
    最近更新 更多