diff --git a/lib/game/pinball_game.dart b/lib/game/pinball_game.dart index 21c291f4..b162aa3c 100644 --- a/lib/game/pinball_game.dart +++ b/lib/game/pinball_game.dart @@ -26,7 +26,6 @@ class PinballGame extends Forge2DGame with FlameBloc, KeyboardEvents { @override Future onLoad() async { - spawnBall(); addContactCallback(BallScorePointsCallback()); await add(BottomWall(this)); @@ -123,4 +122,10 @@ class PinballGame extends Forge2DGame with FlameBloc, KeyboardEvents { return KeyEventResult.handled; } + + @override + void onAttach() { + super.onAttach(); + spawnBall(); + } }