fix: ball spawn logic (#136)

* fix: ball spawn logic

* Update lib/game/components/controlled_ball.dart

Co-authored-by: Alejandro Santiago <dev@alestiago.com>

Co-authored-by: Alejandro Santiago <dev@alestiago.com>
pull/140/head
Erick 4 years ago committed by GitHub
parent b41cd80540
commit d857a784b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -88,7 +88,7 @@ class LaunchedBallController extends BallController
void onNewState(GameState state) {
super.onNewState(state);
component.shouldRemove = true;
if (state.balls > 1) gameRef.spawnBall();
if (state.balls > 0) gameRef.spawnBall();
}
/// Removes the [Ball] from a [PinballGame]; spawning a new [Ball] if

@ -176,7 +176,7 @@ void main() {
await game.ensureAdd(ball);
final state = MockGameState();
when(() => state.balls).thenReturn(1);
when(() => state.balls).thenReturn(0);
final previousBalls = game.descendants().whereType<Ball>().toList();
controller.onNewState(state);

Loading…
Cancel
Save