fix: undo board movement

pull/115/head
RuiAlonso 4 years ago
parent bb85cc9a1c
commit f65c923523

@ -13,8 +13,8 @@ class Board extends Component {
// TODO(alestiago): adjust positioning once sprites are added. // TODO(alestiago): adjust positioning once sprites are added.
final bottomGroup = _BottomGroup( final bottomGroup = _BottomGroup(
position: Vector2( position: Vector2(
PinballGame.boardBounds.center.dx - 5, PinballGame.boardBounds.center.dx,
PinballGame.boardBounds.bottom + 20, PinballGame.boardBounds.bottom + 10,
), ),
spacing: 2, spacing: 2,
); );

@ -101,6 +101,7 @@ class DinoTopWall extends BodyComponent with InitialPosition {
final wallPerspectiveAngle = final wallPerspectiveAngle =
PinballGame.boardPerspectiveAngle + math.pi / 2; PinballGame.boardPerspectiveAngle + math.pi / 2;
// TODO(ruimiguel): calculate final UI wall shape.
final topCurveShape = BezierCurveShape( final topCurveShape = BezierCurveShape(
controlPoints: [ controlPoints: [
Vector2(0, 0), Vector2(0, 0),
@ -114,18 +115,20 @@ class DinoTopWall extends BodyComponent with InitialPosition {
..friction = 0; ..friction = 0;
fixturesDef.add(topFixtureDef); fixturesDef.add(topFixtureDef);
final mediumCurveShape = BezierCurveShape( const bottomCurveShift = -5.0;
// TODO(ruimiguel): calculate final UI wall shape.
final bottomCurveShape = BezierCurveShape(
controlPoints: [ controlPoints: [
Vector2(0 - 5, 0), Vector2(0 + bottomCurveShift, 0),
Vector2(0 - 5, 8), Vector2(0 + bottomCurveShift, 8),
Vector2(3 - 5, 8), Vector2(3 + bottomCurveShift, 8),
Vector2(7 - 5, 0), Vector2(7 + bottomCurveShift, 0),
], ],
)..rotate(wallPerspectiveAngle); )..rotate(wallPerspectiveAngle);
final mediumFixtureDef = FixtureDef(mediumCurveShape) final bottomFixtureDef = FixtureDef(bottomCurveShape)
..restitution = 0.1 ..restitution = 0.1
..friction = 0; ..friction = 0;
fixturesDef.add(mediumFixtureDef); fixturesDef.add(bottomFixtureDef);
return fixturesDef; return fixturesDef;
} }
@ -162,6 +165,7 @@ class DinoBottomWall extends BodyComponent with InitialPosition {
final wallPerspectiveAngle = final wallPerspectiveAngle =
PinballGame.boardPerspectiveAngle + math.pi / 2; PinballGame.boardPerspectiveAngle + math.pi / 2;
// TODO(ruimiguel): calculate final UI wall shape.
final topVertices = [ final topVertices = [
Vector2(0, 0), Vector2(0, 0),
Vector2(0, 5), Vector2(0, 5),
@ -178,11 +182,12 @@ class DinoBottomWall extends BodyComponent with InitialPosition {
..friction = 0; ..friction = 0;
fixturesDef.add(topWallFixtureDef); fixturesDef.add(topWallFixtureDef);
const bottomShift = -20.0;
final bottomVertices = [ final bottomVertices = [
Vector2(0 - 20, 0), Vector2(0 + bottomShift, 0),
Vector2(0 - 20, 4), Vector2(0 + bottomShift, 4),
Vector2(-40 - 20, 4), Vector2(-40 + bottomShift, 4),
Vector2(-40 - 20, 0), Vector2(-40 + bottomShift, 0),
]..forEach((point) { ]..forEach((point) {
point.rotate(wallPerspectiveAngle); point.rotate(wallPerspectiveAngle);
}); });

Loading…
Cancel
Save