From a8c2257ce39f8a414785ffe287e834c1a7516894 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 91e12854..5b5d7885 100644 --- a/lib/game/pinball_game.dart +++ b/lib/game/pinball_game.dart @@ -18,10 +18,15 @@ class PinballGame extends Forge2DGame with FlameBloc { @override Future onLoad() async { - spawnBall(); addContactCallback(BallScorePointsCallback()); await add(BottomWall(this)); addContactCallback(BottomWallBallContactCallback()); } + + @override + void onAttach() { + super.onAttach(); + spawnBall(); + } }