Trying to work out how to set a timer off when the ball goes out of bounds in a pong game, at the moment its automatically relaunching instantly. Been going with a scene pause and resume with set interval a few different ways.
Always starting with…
if (this.ball.body.x < this.playerPaddle.body.x - 25) {
enemyCurrentScore++;
this.scene.restart();
this.scene.pause();
this.time.delayedCall(
3000,
function () {
this.scene.restart();
},
[],
this
);
It looks like you want to do pause then restart after delay. This is a little tricky because a paused scene doesn’t advance its clock so timer events (as in delayedCall()) will not be called.