refactor: moved alien from board to pinball and fixed sprites

pull/166/head
RuiAlonso 4 years ago
parent d34a2aebd4
commit d2c25602dc

@ -15,7 +15,6 @@ class Board extends Component {
final bottomGroup = _BottomGroup();
final flutterForest = FlutterForest();
final alienZone = AlienZone();
// TODO(alestiago): adjust positioning to real design.
final dino = ChromeDino()
@ -28,7 +27,6 @@ class Board extends Component {
bottomGroup,
dino,
flutterForest,
alienZone,
]);
}
}

@ -46,6 +46,7 @@ class PinballGame extends Forge2DGame
await add(plunger);
unawaited(add(Board()));
unawaited(add(AlienZone()));
unawaited(addFromBlueprint(Slingshots()));
unawaited(addFromBlueprint(DinoWalls()));
unawaited(_addBonusWord());

@ -32,7 +32,6 @@ class AlienBumper extends BodyComponent with InitialPosition {
spriteComponent: SpriteComponent(
anchor: Anchor.center,
position: Vector2(0, -0.1),
angle: 15.9 * math.pi / 180,
),
);
@ -46,7 +45,6 @@ class AlienBumper extends BodyComponent with InitialPosition {
spriteComponent: SpriteComponent(
anchor: Anchor.center,
position: Vector2(0, -0.1),
angle: 15.9 * math.pi / 180,
),
);
@ -78,7 +76,7 @@ class AlienBumper extends BodyComponent with InitialPosition {
center: Vector2.zero(),
majorRadius: _majorRadius,
minorRadius: _minorRadius,
)..rotate(math.pi / 1.9);
)..rotate(15.9 * math.pi / 180);
final fixtureDef = FixtureDef(shape)
..friction = 0
..restitution = 4;

@ -62,6 +62,18 @@ void main() {
);
});
flameTester.test(
'one AlienZone',
(game) async {
final alienZone = AlienZone();
await game.ready();
await game.ensureAdd(alienZone);
final flutterForest = alienZone.descendants().whereType<AlienZone>();
expect(flutterForest.length, equals(1));
},
);
group('controller', () {
// TODO(alestiago): Write test to be controller agnostic.
group('listenWhen', () {

Loading…
Cancel
Save