From ab96a9ead885803cbac5bea0ccf34fba00194210 Mon Sep 17 00:00:00 2001 From: Erick Zanardo Date: Mon, 7 Mar 2022 15:54:40 -0300 Subject: [PATCH] fix: changing ball spawning point to avoid context errors --- lib/game/pinball_game.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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(); + } }