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

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

@ -32,7 +32,6 @@ class AlienBumper extends BodyComponent with InitialPosition {
spriteComponent: SpriteComponent( spriteComponent: SpriteComponent(
anchor: Anchor.center, anchor: Anchor.center,
position: Vector2(0, -0.1), position: Vector2(0, -0.1),
angle: 15.9 * math.pi / 180,
), ),
); );
@ -46,7 +45,6 @@ class AlienBumper extends BodyComponent with InitialPosition {
spriteComponent: SpriteComponent( spriteComponent: SpriteComponent(
anchor: Anchor.center, anchor: Anchor.center,
position: Vector2(0, -0.1), position: Vector2(0, -0.1),
angle: 15.9 * math.pi / 180,
), ),
); );
@ -78,7 +76,7 @@ class AlienBumper extends BodyComponent with InitialPosition {
center: Vector2.zero(), center: Vector2.zero(),
majorRadius: _majorRadius, majorRadius: _majorRadius,
minorRadius: _minorRadius, minorRadius: _minorRadius,
)..rotate(math.pi / 1.9); )..rotate(15.9 * math.pi / 180);
final fixtureDef = FixtureDef(shape) final fixtureDef = FixtureDef(shape)
..friction = 0 ..friction = 0
..restitution = 4; ..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', () { group('controller', () {
// TODO(alestiago): Write test to be controller agnostic. // TODO(alestiago): Write test to be controller agnostic.
group('listenWhen', () { group('listenWhen', () {

Loading…
Cancel
Save