|
|
@ -45,16 +45,15 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
..style = PaintingStyle.stroke;
|
|
|
|
..style = PaintingStyle.stroke;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const width = 5.5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static final exitPoint = Vector2(9.2, -48.5);
|
|
|
|
static final exitPoint = Vector2(9.2, -48.5);
|
|
|
|
|
|
|
|
|
|
|
|
List<FixtureDef> _createFixtureDefs() {
|
|
|
|
List<FixtureDef> _createFixtureDefs() {
|
|
|
|
const entranceRotationAngle = 175 * math.pi / 180;
|
|
|
|
const entranceRotationAngle = 175 * math.pi / 180;
|
|
|
|
const curveRotationAngle = 275 * math.pi / 180;
|
|
|
|
const curveRotationAngle = 275 * math.pi / 180;
|
|
|
|
const exitRotationAngle = 340 * math.pi / 180;
|
|
|
|
const exitRotationAngle = 340 * math.pi / 180;
|
|
|
|
|
|
|
|
const width = 5.5;
|
|
|
|
|
|
|
|
|
|
|
|
final fixturesDef = <FixtureDef>[];
|
|
|
|
final fixturesDefs = <FixtureDef>[];
|
|
|
|
|
|
|
|
|
|
|
|
final entranceWall = ArcShape(
|
|
|
|
final entranceWall = ArcShape(
|
|
|
|
center: Vector2(width / 2, 0),
|
|
|
|
center: Vector2(width / 2, 0),
|
|
|
@ -63,7 +62,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
rotation: entranceRotationAngle,
|
|
|
|
rotation: entranceRotationAngle,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
final entranceFixtureDef = FixtureDef(entranceWall);
|
|
|
|
final entranceFixtureDef = FixtureDef(entranceWall);
|
|
|
|
fixturesDef.add(entranceFixtureDef);
|
|
|
|
fixturesDefs.add(entranceFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final topLeftControlPoints = [
|
|
|
|
final topLeftControlPoints = [
|
|
|
|
Vector2(0, 0),
|
|
|
|
Vector2(0, 0),
|
|
|
@ -75,7 +74,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
controlPoints: topLeftControlPoints,
|
|
|
|
controlPoints: topLeftControlPoints,
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
final topLeftFixtureDef = FixtureDef(topLeftCurveShape);
|
|
|
|
final topLeftFixtureDef = FixtureDef(topLeftCurveShape);
|
|
|
|
fixturesDef.add(topLeftFixtureDef);
|
|
|
|
fixturesDefs.add(topLeftFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final topRightControlPoints = [
|
|
|
|
final topRightControlPoints = [
|
|
|
|
Vector2(0, width),
|
|
|
|
Vector2(0, width),
|
|
|
@ -87,7 +86,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
controlPoints: topRightControlPoints,
|
|
|
|
controlPoints: topRightControlPoints,
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
final topRightFixtureDef = FixtureDef(topRightCurveShape);
|
|
|
|
final topRightFixtureDef = FixtureDef(topRightCurveShape);
|
|
|
|
fixturesDef.add(topRightFixtureDef);
|
|
|
|
fixturesDefs.add(topRightFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final mediumLeftControlPoints = [
|
|
|
|
final mediumLeftControlPoints = [
|
|
|
|
topLeftControlPoints.last,
|
|
|
|
topLeftControlPoints.last,
|
|
|
@ -99,7 +98,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
controlPoints: mediumLeftControlPoints,
|
|
|
|
controlPoints: mediumLeftControlPoints,
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
final mediumLeftFixtureDef = FixtureDef(mediumLeftCurveShape);
|
|
|
|
final mediumLeftFixtureDef = FixtureDef(mediumLeftCurveShape);
|
|
|
|
fixturesDef.add(mediumLeftFixtureDef);
|
|
|
|
fixturesDefs.add(mediumLeftFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final mediumRightControlPoints = [
|
|
|
|
final mediumRightControlPoints = [
|
|
|
|
topRightControlPoints.last,
|
|
|
|
topRightControlPoints.last,
|
|
|
@ -111,7 +110,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
controlPoints: mediumRightControlPoints,
|
|
|
|
controlPoints: mediumRightControlPoints,
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
final mediumRightFixtureDef = FixtureDef(mediumRightCurveShape);
|
|
|
|
final mediumRightFixtureDef = FixtureDef(mediumRightCurveShape);
|
|
|
|
fixturesDef.add(mediumRightFixtureDef);
|
|
|
|
fixturesDefs.add(mediumRightFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final bottomLeftControlPoints = [
|
|
|
|
final bottomLeftControlPoints = [
|
|
|
|
mediumLeftControlPoints.last,
|
|
|
|
mediumLeftControlPoints.last,
|
|
|
@ -123,7 +122,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
controlPoints: bottomLeftControlPoints,
|
|
|
|
controlPoints: bottomLeftControlPoints,
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
final bottomLeftFixtureDef = FixtureDef(bottomLeftCurveShape);
|
|
|
|
final bottomLeftFixtureDef = FixtureDef(bottomLeftCurveShape);
|
|
|
|
fixturesDef.add(bottomLeftFixtureDef);
|
|
|
|
fixturesDefs.add(bottomLeftFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final bottomRightControlPoints = [
|
|
|
|
final bottomRightControlPoints = [
|
|
|
|
mediumRightControlPoints.last,
|
|
|
|
mediumRightControlPoints.last,
|
|
|
@ -135,7 +134,7 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
controlPoints: bottomRightControlPoints,
|
|
|
|
controlPoints: bottomRightControlPoints,
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
)..rotate(curveRotationAngle);
|
|
|
|
final bottomRightFixtureDef = FixtureDef(bottomRightCurveShape);
|
|
|
|
final bottomRightFixtureDef = FixtureDef(bottomRightCurveShape);
|
|
|
|
fixturesDef.add(bottomRightFixtureDef);
|
|
|
|
fixturesDefs.add(bottomRightFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
final exitWall = ArcShape(
|
|
|
|
final exitWall = ArcShape(
|
|
|
|
center: exitPoint,
|
|
|
|
center: exitPoint,
|
|
|
@ -144,9 +143,9 @@ class _SpaceshipExitRailRamp extends BodyComponent
|
|
|
|
rotation: exitRotationAngle,
|
|
|
|
rotation: exitRotationAngle,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
final exitFixtureDef = FixtureDef(exitWall);
|
|
|
|
final exitFixtureDef = FixtureDef(exitWall);
|
|
|
|
fixturesDef.add(exitFixtureDef);
|
|
|
|
fixturesDefs.add(exitFixtureDef);
|
|
|
|
|
|
|
|
|
|
|
|
return fixturesDef;
|
|
|
|
return fixturesDefs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|