|
|
@ -30,20 +30,23 @@ class JetpackRamp extends Component with HasGameRef<PinballGame> {
|
|
|
|
// TODO(ruialonso): Use a bezier curve once control points are defined.
|
|
|
|
// TODO(ruialonso): Use a bezier curve once control points are defined.
|
|
|
|
color: const Color.fromARGB(255, 8, 218, 241),
|
|
|
|
color: const Color.fromARGB(255, 8, 218, 241),
|
|
|
|
center: position,
|
|
|
|
center: position,
|
|
|
|
width: 20,
|
|
|
|
width: 5,
|
|
|
|
radius: 60,
|
|
|
|
radius: 18,
|
|
|
|
angle: math.pi,
|
|
|
|
angle: math.pi,
|
|
|
|
)
|
|
|
|
rotation: math.pi,
|
|
|
|
..initialPosition = position + Vector2(60, 0)
|
|
|
|
)..layer = layer;
|
|
|
|
..layer = layer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO figure out the new values for this
|
|
|
|
final leftOpening = _JetpackRampOpening(
|
|
|
|
final leftOpening = _JetpackRampOpening(outsideLayer: Layer.spaceship)
|
|
|
|
outsideLayer: Layer.spaceship,
|
|
|
|
..initialPosition = position + Vector2(-27.6, 25.3)
|
|
|
|
rotation: math.pi,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
..initialPosition = position - Vector2(2, 22)
|
|
|
|
..layer = Layer.jetpack;
|
|
|
|
..layer = Layer.jetpack;
|
|
|
|
|
|
|
|
|
|
|
|
final rightOpening = _JetpackRampOpening()
|
|
|
|
final rightOpening = _JetpackRampOpening(
|
|
|
|
..initialPosition = position + Vector2(-10.6, 25.3)
|
|
|
|
rotation: math.pi,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
..initialPosition = position - Vector2(-13, 22)
|
|
|
|
..layer = Layer.opening;
|
|
|
|
..layer = Layer.opening;
|
|
|
|
|
|
|
|
|
|
|
|
await addAll([
|
|
|
|
await addAll([
|
|
|
@ -62,20 +65,26 @@ class _JetpackRampOpening extends RampOpening {
|
|
|
|
/// {@macro jetpack_ramp_opening}
|
|
|
|
/// {@macro jetpack_ramp_opening}
|
|
|
|
_JetpackRampOpening({
|
|
|
|
_JetpackRampOpening({
|
|
|
|
Layer? outsideLayer,
|
|
|
|
Layer? outsideLayer,
|
|
|
|
}) : super(
|
|
|
|
required double rotation,
|
|
|
|
|
|
|
|
}) : _rotation = rotation,
|
|
|
|
|
|
|
|
super(
|
|
|
|
pathwayLayer: Layer.jetpack,
|
|
|
|
pathwayLayer: Layer.jetpack,
|
|
|
|
outsideLayer: outsideLayer,
|
|
|
|
outsideLayer: outsideLayer,
|
|
|
|
orientation: RampOrientation.down,
|
|
|
|
orientation: RampOrientation.down,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(ruialonso): Avoid magic number 2, should be proportional to
|
|
|
|
final double _rotation;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(ruialonso): Avoid magic number 3, should be propotional to
|
|
|
|
// [JetpackRamp].
|
|
|
|
// [JetpackRamp].
|
|
|
|
static const _size = 2;
|
|
|
|
static final Vector2 _size = Vector2(3, .1);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Shape get shape => PolygonShape()
|
|
|
|
Shape get shape => PolygonShape()
|
|
|
|
..setAsEdge(
|
|
|
|
..setAsBox(
|
|
|
|
Vector2(initialPosition.x - _size, initialPosition.y),
|
|
|
|
_size.x,
|
|
|
|
Vector2(initialPosition.x + _size, initialPosition.y),
|
|
|
|
_size.y,
|
|
|
|
|
|
|
|
initialPosition,
|
|
|
|
|
|
|
|
_rotation,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|