feat: implemented stop and reusme methods

pull/58/head
alestiago 4 years ago
parent 9fd7078968
commit 74fbbc9df0

@ -61,4 +61,19 @@ class Ball extends BodyComponent<PinballGame> 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);
}
}

Loading…
Cancel
Save