chore: clean up dino wall fixture defs

pull/229/head
Allison Ryan 3 years ago
parent 96c9a7ab84
commit 1c4e69d408

@ -38,7 +38,6 @@ class _DinoTopWall extends BodyComponent with InitialPosition {
Vector2(28.65, -34.3), Vector2(28.65, -34.3),
Vector2(29.5, -34.3), Vector2(29.5, -34.3),
); );
final topStraightFixtureDef = FixtureDef(topStraightShape);
final topCurveShape = BezierCurveShape( final topCurveShape = BezierCurveShape(
controlPoints: [ controlPoints: [
@ -47,7 +46,6 @@ class _DinoTopWall extends BodyComponent with InitialPosition {
Vector2(26.6, -20.2), Vector2(26.6, -20.2),
], ],
); );
final topCurveFixtureDef = FixtureDef(topCurveShape);
final middleCurveShape = BezierCurveShape( final middleCurveShape = BezierCurveShape(
controlPoints: [ controlPoints: [
@ -56,7 +54,6 @@ class _DinoTopWall extends BodyComponent with InitialPosition {
Vector2(26.8, -18.7), Vector2(26.8, -18.7),
], ],
); );
final middleCurveFixtureDef = FixtureDef(middleCurveShape);
final bottomCurveShape = BezierCurveShape( final bottomCurveShape = BezierCurveShape(
controlPoints: [ controlPoints: [
@ -65,21 +62,19 @@ class _DinoTopWall extends BodyComponent with InitialPosition {
Vector2(27, -14.2), Vector2(27, -14.2),
], ],
); );
final bottomCurveFixtureDef = FixtureDef(bottomCurveShape);
final bottomStraightShape = EdgeShape() final bottomStraightShape = EdgeShape()
..set( ..set(
bottomCurveShape.vertices.last, bottomCurveShape.vertices.last,
Vector2(31, -13.7), Vector2(31, -13.7),
); );
final bottomStraightFixtureDef = FixtureDef(bottomStraightShape);
return [ return [
topStraightFixtureDef, FixtureDef(topStraightShape),
topCurveFixtureDef, FixtureDef(topCurveShape),
middleCurveFixtureDef, FixtureDef(middleCurveShape),
bottomCurveFixtureDef, FixtureDef(bottomCurveShape),
bottomStraightFixtureDef, FixtureDef(bottomStraightShape),
]; ];
} }
@ -131,17 +126,11 @@ class _DinoBottomWall extends BodyComponent with InitialPosition {
); );
List<FixtureDef> _createFixtureDefs() { List<FixtureDef> _createFixtureDefs() {
const restitution = 1.0;
final topStraightShape = EdgeShape() final topStraightShape = EdgeShape()
..set( ..set(
Vector2(32.4, -8.8), Vector2(32.4, -8.8),
Vector2(25, -7.7), Vector2(25, -7.7),
); );
final topStraightFixtureDef = FixtureDef(
topStraightShape,
restitution: restitution,
);
final topLeftCurveShape = BezierCurveShape( final topLeftCurveShape = BezierCurveShape(
controlPoints: [ controlPoints: [
@ -150,36 +139,24 @@ class _DinoBottomWall extends BodyComponent with InitialPosition {
Vector2(29.8, 13.8), Vector2(29.8, 13.8),
], ],
); );
final topLeftCurveFixtureDef = FixtureDef(
topLeftCurveShape,
restitution: restitution,
);
final bottomLeftStraightShape = EdgeShape() final bottomLeftStraightShape = EdgeShape()
..set( ..set(
topLeftCurveShape.vertices.last, topLeftCurveShape.vertices.last,
Vector2(31.9, 44.1), Vector2(31.9, 44.1),
); );
final bottomLeftStraightFixtureDef = FixtureDef(
bottomLeftStraightShape,
restitution: restitution,
);
final bottomStraightShape = EdgeShape() final bottomStraightShape = EdgeShape()
..set( ..set(
bottomLeftStraightShape.vertex2, bottomLeftStraightShape.vertex2,
Vector2(37.8, 44.1), Vector2(37.8, 44.1),
); );
final bottomStraightFixtureDef = FixtureDef(
bottomStraightShape,
restitution: restitution,
);
return [ return [
topStraightFixtureDef, FixtureDef(topStraightShape),
topLeftCurveFixtureDef, FixtureDef(topLeftCurveShape),
bottomLeftStraightFixtureDef, FixtureDef(bottomLeftStraightShape),
bottomStraightFixtureDef, FixtureDef(bottomStraightShape),
]; ];
} }

Loading…
Cancel
Save