How to replace this code:
ball.checkWorldBounds = true;
ball.events.onOutOfBounds.add(() => {
alert("Game over!");
location.reload();
}, this);
It is from the Game over lesson. I have tried to use this solution: Out of bounds checking - #5 by PavelMishin
function update() {
paddle.x = this.input.x || this.scale.width * 0.5;
const inside = Geom.Rectangle.Overlaps(this.physics.world.bounds, ball.getBounds());
if (!inside) {
alert('Game over!');
location.reload();
}
}
But it cannot be reloaded: Playground