Pause and Resume Game in Phaser 3
If you just want to freeze a character, you can use this.sprite.body.moves = false;
In phaser3 you can have several scenes running in parallel. So you can create a new scene with the resume button and pause the current scene. If you have 2 scenes A e B you can do:
# 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();
})
Call game.scene.pause("default")
if you have only the default scene. If you have more call it like this game.scene.pause(sceneKey)
.
Docs at: https://photonstorm.github.io/phaser3-docs/Phaser.Scenes.SceneManager.html