在 Phaser-3 框架中是否有任何方法可以暂停正在运行的游戏并恢复(使用按钮)?为 Phaser-2 提供的那个不起作用。
最佳答案
在 phaser3 中,您可以同时运行多个场景。因此,您可以使用恢复按钮创建新场景并暂停当前场景。如果你有 2 个场景 A e B 你可以这样做:
# In scene A
this.scene.launch('sceneB')
this.scene.pause();
# Then in sceneB, you can return to sceneA:
button.on('pointerdown', function() {
this.scene.resume('sceneA');
this.scene.stop();
})
关于javascript - 在 Phaser 3 中暂停和恢复游戏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50988219/