From ad0c6b76fe38c2db1345ce23bf25745f76e05796 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Tue, 19 Apr 2022 14:27:23 +0200 Subject: [PATCH] refactor: extended launcher foreground rail until boundary bottom to avoid balls scape from dino --- .../lib/src/components/launch_ramp.dart | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/pinball_components/lib/src/components/launch_ramp.dart b/packages/pinball_components/lib/src/components/launch_ramp.dart index 5d355a5c..c144f38d 100644 --- a/packages/pinball_components/lib/src/components/launch_ramp.dart +++ b/packages/pinball_components/lib/src/components/launch_ramp.dart @@ -164,7 +164,13 @@ class _LaunchRampBackgroundRailingSpriteComponent extends SpriteComponent /// {@endtemplate} class _LaunchRampForegroundRailing extends BodyComponent with InitialPosition { /// {@macro launch_ramp_foreground_railing} - _LaunchRampForegroundRailing() : super(priority: Ball.launchRampPriority + 1); + _LaunchRampForegroundRailing() + : super( + priority: Ball.launchRampPriority + 1, + children: [_LaunchRampForegroundRailingSpriteComponent()], + ) { + renderBody = false; + } List _createFixtureDefs() { final fixturesDef = []; @@ -172,7 +178,7 @@ class _LaunchRampForegroundRailing extends BodyComponent with InitialPosition { final rightStraightShape = EdgeShape() ..set( Vector2(27.6, -57.9), - Vector2(30, -35.1), + Vector2(38.1, 42.6), ); final rightStraightFixtureDef = FixtureDef(rightStraightShape); fixturesDef.add(rightStraightFixtureDef); @@ -208,14 +214,6 @@ class _LaunchRampForegroundRailing extends BodyComponent with InitialPosition { return body; } - - @override - Future onLoad() async { - await super.onLoad(); - renderBody = false; - - await add(_LaunchRampForegroundRailingSpriteComponent()); - } } class _LaunchRampForegroundRailingSpriteComponent extends SpriteComponent