From 9738f2def7d416b8cc173840918354796171915a Mon Sep 17 00:00:00 2001 From: Jochum van der Ploeg Date: Thu, 28 Apr 2022 13:59:54 +0200 Subject: [PATCH] feat: add mobile touch controls --- lib/game/pinball_game.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/game/pinball_game.dart b/lib/game/pinball_game.dart index bb143f13..8c87d33f 100644 --- a/lib/game/pinball_game.dart +++ b/lib/game/pinball_game.dart @@ -81,11 +81,11 @@ class PinballGame extends Forge2DGame @override void onTapDown(TapDownInfo info) { if (info.raw.kind == PointerDeviceKind.touch) { - final rocket = descendants().whereType().first; + final rocket = children.whereType().first; final bounds = rocket.topLeftPosition & rocket.size; if (bounds.contains(info.eventPosition.game.toOffset())) { - descendants().whereType().first.pull(); + children.whereType().first.pull(); } else { final leftSide = info.eventPosition.widget.x < canvasSize.x / 2; boardSideActive = leftSide ? BoardSide.left : BoardSide.right; @@ -108,7 +108,7 @@ class PinballGame extends Forge2DGame final bounds = rocket.topLeftPosition & rocket.size; if (bounds.contains(info.eventPosition.game.toOffset())) { - descendants().whereType().first.release(); + children.whereType().first.release(); } else { _moveFlippersDown(); } @@ -117,7 +117,7 @@ class PinballGame extends Forge2DGame @override void onTapCancel() { - descendants().whereType().first.release(); + children.whereType().first.release(); _moveFlippersDown(); super.onTapCancel();