refactor: flipper position and angle (#161)

* chore: board todos

* refactor: flipper position and angle

* fix: unused import

* style: add space in comment

* chore: half sweeping angle
pull/167/head
Allison Ryan 4 years ago committed by GitHub
parent 5fe5fc007d
commit 502babf38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,11 +12,14 @@ class Board extends Component {
@override
Future<void> onLoad() async {
// TODO(allisonryan0002): add bottom group and flutter forest to pinball
// game directly. Then remove board.
final bottomGroup = _BottomGroup();
final flutterForest = FlutterForest();
// TODO(alestiago): adjust positioning to real design.
// TODO(alestiago): add dino in pinball game.
final dino = ChromeDino()
..initialPosition = Vector2(
BoardDimensions.bounds.center.dx + 25,
@ -74,7 +77,7 @@ class _BottomGroupSide extends Component {
final flipper = ControlledFlipper(
side: _side,
)..initialPosition = Vector2((11.0 * direction) + centerXAdjustment, -42.4);
)..initialPosition = Vector2((11.8 * direction) + centerXAdjustment, -43.6);
final baseboard = Baseboard(side: _side)
..initialPosition = Vector2(
(25.58 * direction) + centerXAdjustment,

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:math' as math;
import 'package:flame/components.dart';
import 'package:flame_forge2d/flame_forge2d.dart';
@ -198,8 +197,8 @@ class _FlipperJoint extends RevoluteJoint {
lock();
}
/// The total angle of the arc motion.
static const _sweepingAngle = math.pi / 3.5;
/// Half the angle of the arc motion.
static const _halfSweepingAngle = 0.611;
final BoardSide side;
@ -208,7 +207,7 @@ class _FlipperJoint extends RevoluteJoint {
/// The joint is locked when initialized in order to force the [Flipper]
/// at its resting position.
void lock() {
const angle = _sweepingAngle / 2;
const angle = _halfSweepingAngle;
setLimits(
-angle * side.direction,
-angle * side.direction,
@ -217,7 +216,7 @@ class _FlipperJoint extends RevoluteJoint {
/// Unlocks the [Flipper] from its resting position.
void unlock() {
const angle = _sweepingAngle / 2;
const angle = _halfSweepingAngle;
setLimits(-angle, angle);
}
}

Loading…
Cancel
Save