diff --git a/lib/game/components/ball.dart b/lib/game/components/ball.dart index 36ed8929..0795767c 100644 --- a/lib/game/components/ball.dart +++ b/lib/game/components/ball.dart @@ -61,4 +61,19 @@ class Ball extends BodyComponent with InitialPosition { gameRef.spawnBall(); } } + + /// Immediatly and completly [stop]s the ball. + /// + /// The [Ball] will no longer be affected by any forces, including it's + /// weight and those emitted from collisions. + void stop() { + body.setType(BodyType.static); + } + + /// Allows the [Ball] to be affected by forces. + /// + /// If when previously [stop]ed, the previous ball's velocity is not kept. + void resume() { + body.setType(BodyType.dynamic); + } }