From 5b0bcc0b2000b7dc02f32ecdcfa3e26b3be86660 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Wed, 6 Apr 2022 10:24:23 +0200 Subject: [PATCH] refactor: changed spawnBall initialPosition --- lib/game/pinball_game.dart | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/game/pinball_game.dart b/lib/game/pinball_game.dart index 0eb5fb41..a6eb0884 100644 --- a/lib/game/pinball_game.dart +++ b/lib/game/pinball_game.dart @@ -21,8 +21,6 @@ class PinballGame extends Forge2DGame final PinballAudio audio; - late Plunger plunger; - @override void onAttach() { super.onAttach(); @@ -72,8 +70,8 @@ class PinballGame extends Forge2DGame } Future _addPlunger() async { - plunger = Plunger(compressionDistance: 29) - ..initialPosition = Vector2(38.2, -19); + final plunger = Plunger(compressionDistance: 29) + ..initialPosition = Vector2(38, -19); await add(plunger); } @@ -89,12 +87,10 @@ class PinballGame extends Forge2DGame } Future spawnBall() async { + // TODO(alestiago): Remove once this logic is moved to controller. final ball = ControlledBall.launch( theme: theme, - )..initialPosition = Vector2( - plunger.body.position.x, - plunger.body.position.y + Ball.size.y, - ); + )..initialPosition = Vector2(38, -19 + Ball.size.y); await add(ball); } }