refactor: removed plunger null checks

pull/151/head
alestiago 4 years ago
parent 719b07069e
commit b5aef4640c

@ -95,7 +95,7 @@ class _GameBallsController extends ComponentController<PinballGame>
with BlocComponent<GameBloc, GameState>, HasGameRef<PinballGame> {
_GameBallsController(PinballGame game) : super(game);
Plunger? _plunger;
late final Plunger _plunger;
@override
bool listenWhen(GameState? previousState, GameState newState) {
@ -120,13 +120,11 @@ class _GameBallsController extends ComponentController<PinballGame>
}
void _spawnBall() {
if (_plunger == null) return;
final ball = ControlledBall.launch(
theme: gameRef.theme,
)..initialPosition = Vector2(
_plunger!.body.position.x,
_plunger!.body.position.y + Ball.size.y,
_plunger.body.position.x,
_plunger.body.position.y + Ball.size.y,
);
component.add(ball);
}

Loading…
Cancel
Save