refactor: shrink sensor and add foreground

pull/135/head
Allison Ryan 4 years ago
parent 0285698e5c
commit ed45883b03

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -29,12 +29,14 @@ class SpaceshipExitRail extends Forge2DBlueprint {
..initialPosition = Vector2(-26.15, 18.65); ..initialPosition = Vector2(-26.15, 18.65);
final bottomBase = _SpaceshipExitRailBase(radius: 0.8) final bottomBase = _SpaceshipExitRailBase(radius: 0.8)
..initialPosition = Vector2(-25.5, -12.9); ..initialPosition = Vector2(-25.5, -12.9);
final exitRailForeground = _SpaceshipExitRailForeground();
addAll([ addAll([
exitRailRamp, exitRailRamp,
exitRailEnd, exitRailEnd,
topBase, topBase,
bottomBase, bottomBase,
exitRailForeground,
]); ]);
} }
} }
@ -155,6 +157,24 @@ class _SpaceshipExitRailRamp extends BodyComponent
} }
} }
class _SpaceshipExitRailForeground extends SpriteComponent with HasGameRef {
_SpaceshipExitRailForeground()
: super(
size: Vector2(7.6, 5.7),
anchor: Anchor.center,
position: Vector2(-28.5, 19.7),
priority: SpaceshipExitRail.ballPriorityWhenOnSpaceshipExitRail + 1,
);
@override
Future<void> onLoad() async {
await super.onLoad();
sprite = await gameRef
.loadSprite(Assets.images.components.spaceshipDropTubeFront.path);
}
}
class _SpaceshipExitRailBase extends BodyComponent class _SpaceshipExitRailBase extends BodyComponent
with InitialPosition, Layered { with InitialPosition, Layered {
_SpaceshipExitRailBase({required this.radius}) _SpaceshipExitRailBase({required this.radius})
@ -193,16 +213,16 @@ class SpaceshipExitRailEnd extends RampOpening {
orientation: RampOrientation.down, orientation: RampOrientation.down,
insidePriority: 3, insidePriority: 3,
) { ) {
renderBody = false; // renderBody = false;
layer = Layer.spaceshipExitRail; layer = Layer.spaceshipExitRail;
} }
@override @override
Shape get shape { Shape get shape {
return ArcShape( return ArcShape(
center: Vector2(-29, -17.8), center: Vector2(-28, -19),
arcRadius: 2.5, arcRadius: 2.5,
angle: math.pi * 0.8, angle: math.pi * 0.4,
rotation: -0.16, rotation: -0.16,
); );
} }

@ -26,6 +26,7 @@ extension PinballGameAssetsX on PinballGame {
images.load(Assets.images.components.spaceshipRailingBg.path), images.load(Assets.images.components.spaceshipRailingBg.path),
images.load(Assets.images.components.spaceshipRailingFg.path), images.load(Assets.images.components.spaceshipRailingFg.path),
images.load(Assets.images.components.spaceshipDropTube.path), images.load(Assets.images.components.spaceshipDropTube.path),
images.load(Assets.images.components.spaceshipDropTubeFront.path),
]); ]);
} }
} }

@ -21,6 +21,10 @@ class $AssetsImagesComponentsGen {
AssetGenImage get background => AssetGenImage get background =>
const AssetGenImage('assets/images/components/background.png'); const AssetGenImage('assets/images/components/background.png');
/// File path: assets/images/components/spaceship-drop-tube-front.png
AssetGenImage get spaceshipDropTubeFront => const AssetGenImage(
'assets/images/components/spaceship-drop-tube-front.png');
/// File path: assets/images/components/spaceship-drop-tube.png /// File path: assets/images/components/spaceship-drop-tube.png
AssetGenImage get spaceshipDropTube => AssetGenImage get spaceshipDropTube =>
const AssetGenImage('assets/images/components/spaceship-drop-tube.png'); const AssetGenImage('assets/images/components/spaceship-drop-tube.png');

Loading…
Cancel
Save