class ExampleScene extends Phaser.Scene {
// ...
hitPaddle(ball, paddle) {
this.ball.anims.play("wobble");
ball.body.velocity.x = -5 * (paddle.x - ball.x);
}
// ...
}Randomizing gameplay / notebook
Randomizing gameplay
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.