mirror of https://github.com/flutter/pinball.git
commit
02dd698336
@ -0,0 +1,83 @@
|
||||
import 'package:flame/components.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
/// {@template bottom_group}
|
||||
/// Grouping of the board's bottom [Component]s.
|
||||
///
|
||||
/// The bottom [Component]s are the [Flipper]s and the [Baseboard]s.
|
||||
/// {@endtemplate}
|
||||
// TODO(alestiago): Consider renaming once entire Board is defined.
|
||||
class BottomGroup extends Component {
|
||||
/// {@macro bottom_group}
|
||||
BottomGroup({
|
||||
required this.position,
|
||||
required this.spacing,
|
||||
});
|
||||
|
||||
/// The amount of space between the line of symmetry.
|
||||
final double spacing;
|
||||
|
||||
/// The position of this [BottomGroup].
|
||||
final Vector2 position;
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
final spacing = this.spacing + Flipper.width / 2;
|
||||
final rightSide = _BottomGroupSide(
|
||||
side: BoardSide.right,
|
||||
position: position + Vector2(spacing, 0),
|
||||
);
|
||||
final leftSide = _BottomGroupSide(
|
||||
side: BoardSide.left,
|
||||
position: position + Vector2(-spacing, 0),
|
||||
);
|
||||
|
||||
await addAll([rightSide, leftSide]);
|
||||
}
|
||||
}
|
||||
|
||||
/// {@template bottom_group_side}
|
||||
/// Group with one side of [BottomGroup]'s symmetric [Component]s.
|
||||
///
|
||||
/// For example, [Flipper]s are symmetric components.
|
||||
/// {@endtemplate}
|
||||
class _BottomGroupSide extends Component {
|
||||
/// {@macro bottom_group_side}
|
||||
_BottomGroupSide({
|
||||
required BoardSide side,
|
||||
required Vector2 position,
|
||||
}) : _side = side,
|
||||
_position = position;
|
||||
|
||||
final BoardSide _side;
|
||||
|
||||
final Vector2 _position;
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
final direction = _side.direction;
|
||||
|
||||
final flipper = Flipper.fromSide(
|
||||
side: _side,
|
||||
position: _position,
|
||||
);
|
||||
final baseboard = Baseboard(
|
||||
side: _side,
|
||||
position: _position +
|
||||
Vector2(
|
||||
(Flipper.width * direction) - direction,
|
||||
Flipper.height,
|
||||
),
|
||||
);
|
||||
final slingShot = SlingShot(
|
||||
side: _side,
|
||||
position: _position +
|
||||
Vector2(
|
||||
(Flipper.width) * direction,
|
||||
Flipper.height + SlingShot.size.y,
|
||||
),
|
||||
);
|
||||
|
||||
await addAll([flipper, baseboard, slingShot]);
|
||||
}
|
||||
}
|
@ -1,10 +1,14 @@
|
||||
export 'ball.dart';
|
||||
export 'baseboard.dart';
|
||||
export 'board.dart';
|
||||
export 'board_side.dart';
|
||||
export 'bonus_word.dart';
|
||||
export 'flipper.dart';
|
||||
export 'initial_position.dart';
|
||||
export 'joint_anchor.dart';
|
||||
export 'pathway.dart';
|
||||
export 'plunger.dart';
|
||||
export 'round_bumper.dart';
|
||||
export 'score_points.dart';
|
||||
export 'sling_shot.dart';
|
||||
export 'wall.dart';
|
||||
|
@ -0,0 +1,17 @@
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
|
||||
/// Forces a given [BodyComponent] to position their [body] to an
|
||||
/// [initialPosition].
|
||||
mixin InitialPosition<T extends Forge2DGame> on BodyComponent<T> {
|
||||
/// The initial position of the [body].
|
||||
late final Vector2 initialPosition;
|
||||
|
||||
@override
|
||||
void onMount() {
|
||||
super.onMount();
|
||||
assert(
|
||||
body.position == initialPosition,
|
||||
'Body position is not equal to initial position.',
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
/// {@template round_bumper}
|
||||
/// Circular body that repels a [Ball] on contact, increasing the score.
|
||||
/// {@endtemplate}
|
||||
class RoundBumper extends BodyComponent with ScorePoints {
|
||||
/// {@macro round_bumper}
|
||||
RoundBumper({
|
||||
required Vector2 position,
|
||||
required double radius,
|
||||
required int points,
|
||||
}) : _position = position,
|
||||
_radius = radius,
|
||||
_points = points;
|
||||
|
||||
/// The position of the [RoundBumper] body.
|
||||
final Vector2 _position;
|
||||
|
||||
/// The radius of the [RoundBumper].
|
||||
final double _radius;
|
||||
|
||||
/// Points awarded from hitting this [RoundBumper].
|
||||
final int _points;
|
||||
|
||||
@override
|
||||
int get points => _points;
|
||||
|
||||
@override
|
||||
Body createBody() {
|
||||
final shape = CircleShape()..radius = _radius;
|
||||
|
||||
final fixtureDef = FixtureDef(shape)..restitution = 1;
|
||||
|
||||
final bodyDef = BodyDef()
|
||||
..position = _position
|
||||
..type = BodyType.static;
|
||||
|
||||
return world.createBody(bodyDef)..createFixture(fixtureDef);
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
import 'package:flame/extensions.dart';
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geometry/geometry.dart' show centroid;
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
/// {@template sling_shot}
|
||||
/// Triangular [BodyType.static] body that propels the [Ball] towards the
|
||||
/// opposite side.
|
||||
///
|
||||
/// [SlingShot]s are usually positioned above each [Flipper].
|
||||
/// {@endtemplate sling_shot}
|
||||
class SlingShot extends BodyComponent {
|
||||
/// {@macro sling_shot}
|
||||
SlingShot({
|
||||
required Vector2 position,
|
||||
required BoardSide side,
|
||||
}) : _position = position,
|
||||
_side = side {
|
||||
// TODO(alestiago): Use sprite instead of color when provided.
|
||||
paint = Paint()
|
||||
..color = const Color(0xFF00FF00)
|
||||
..style = PaintingStyle.fill;
|
||||
}
|
||||
|
||||
/// The initial position of the [SlingShot] body.
|
||||
final Vector2 _position;
|
||||
|
||||
/// Whether the [SlingShot] is on the left or right side of the board.
|
||||
///
|
||||
/// A [SlingShot] with [BoardSide.left] propels the [Ball] to the right,
|
||||
/// whereas a [SlingShot] with [BoardSide.right] propels the [Ball] to the
|
||||
/// left.
|
||||
final BoardSide _side;
|
||||
|
||||
/// The size of the [SlingShot] body.
|
||||
// TODO(alestiago): Use size from PositionedBodyComponent instead,
|
||||
// once a sprite is given.
|
||||
static final Vector2 size = Vector2(6, 8);
|
||||
|
||||
List<FixtureDef> _createFixtureDefs() {
|
||||
final fixtures = <FixtureDef>[];
|
||||
|
||||
// TODO(alestiago): This magic number can be deduced by specifying the
|
||||
// angle and using polar coordinate system to place the bottom right
|
||||
// vertex.
|
||||
// Something as: y = -size.y * math.cos(angle)
|
||||
const additionalIncrement = 3;
|
||||
final triangleVertices = _side.isLeft
|
||||
? [
|
||||
Vector2(0, 0),
|
||||
Vector2(0, -size.y),
|
||||
Vector2(
|
||||
size.x,
|
||||
-size.y - additionalIncrement,
|
||||
),
|
||||
]
|
||||
: [
|
||||
Vector2(size.x, 0),
|
||||
Vector2(size.x, -size.y),
|
||||
Vector2(
|
||||
0,
|
||||
-size.y - additionalIncrement,
|
||||
),
|
||||
];
|
||||
final triangleCentroid = centroid(triangleVertices);
|
||||
for (final vertex in triangleVertices) {
|
||||
vertex.setFrom(vertex - triangleCentroid);
|
||||
}
|
||||
|
||||
final triangle = PolygonShape()..set(triangleVertices);
|
||||
final triangleFixtureDef = FixtureDef(triangle)..friction = 0;
|
||||
fixtures.add(triangleFixtureDef);
|
||||
|
||||
final kicker = EdgeShape()
|
||||
..set(
|
||||
triangleVertices.first,
|
||||
triangleVertices.last,
|
||||
);
|
||||
// TODO(alestiago): Play with restitution value once game is bundled.
|
||||
final kickerFixtureDef = FixtureDef(kicker)
|
||||
..restitution = 10.0
|
||||
..friction = 0;
|
||||
fixtures.add(kickerFixtureDef);
|
||||
|
||||
return fixtures;
|
||||
}
|
||||
|
||||
@override
|
||||
Body createBody() {
|
||||
final bodyDef = BodyDef()..position = _position;
|
||||
final body = world.createBody(bodyDef);
|
||||
_createFixtureDefs().forEach(body.createFixture);
|
||||
|
||||
return body;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
// ignore_for_file: cascade_invocations
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:flame_test/flame_test.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
import '../../helpers/helpers.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
final flameTester = FlameTester(Forge2DGame.new);
|
||||
|
||||
group('BottomGroup', () {
|
||||
flameTester.test(
|
||||
'loads correctly',
|
||||
(game) async {
|
||||
final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0);
|
||||
await game.ready();
|
||||
await game.ensureAdd(bottomGroup);
|
||||
|
||||
expect(game.contains(bottomGroup), isTrue);
|
||||
},
|
||||
);
|
||||
|
||||
group('children', () {
|
||||
flameTester.test(
|
||||
'has one left flipper',
|
||||
(game) async {
|
||||
final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0);
|
||||
await game.ready();
|
||||
await game.ensureAdd(bottomGroup);
|
||||
|
||||
final leftFlippers = bottomGroup.findNestedChildren<Flipper>(
|
||||
condition: (flipper) => flipper.side.isLeft,
|
||||
);
|
||||
expect(leftFlippers.length, equals(1));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has one right flipper',
|
||||
(game) async {
|
||||
final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0);
|
||||
await game.ready();
|
||||
await game.ensureAdd(bottomGroup);
|
||||
|
||||
final rightFlippers = bottomGroup.findNestedChildren<Flipper>(
|
||||
condition: (flipper) => flipper.side.isRight,
|
||||
);
|
||||
expect(rightFlippers.length, equals(1));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has two Baseboards',
|
||||
(game) async {
|
||||
final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0);
|
||||
await game.ready();
|
||||
await game.ensureAdd(bottomGroup);
|
||||
|
||||
final baseboards = bottomGroup.findNestedChildren<Baseboard>();
|
||||
expect(baseboards.length, equals(2));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has two SlingShots',
|
||||
(game) async {
|
||||
final bottomGroup = BottomGroup(position: Vector2.zero(), spacing: 0);
|
||||
await game.ready();
|
||||
await game.ensureAdd(bottomGroup);
|
||||
|
||||
final slingShots = bottomGroup.findNestedChildren<SlingShot>();
|
||||
expect(slingShots.length, equals(2));
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// ignore_for_file: cascade_invocations
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:flame_test/flame_test.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
class TestBodyComponent extends BodyComponent with InitialPosition {
|
||||
@override
|
||||
Body createBody() {
|
||||
return world.createBody(BodyDef());
|
||||
}
|
||||
}
|
||||
|
||||
class TestPositionedBodyComponent extends BodyComponent with InitialPosition {
|
||||
@override
|
||||
Body createBody() {
|
||||
return world.createBody(BodyDef()..position = initialPosition);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
final flameTester = FlameTester(Forge2DGame.new);
|
||||
group('InitialPosition', () {
|
||||
test('correctly sets and gets', () {
|
||||
final component = TestBodyComponent()..initialPosition = Vector2(1, 2);
|
||||
expect(component.initialPosition, Vector2(1, 2));
|
||||
});
|
||||
|
||||
test('can only be set once', () {
|
||||
final component = TestBodyComponent()..initialPosition = Vector2(1, 2);
|
||||
expect(
|
||||
() => component.initialPosition = Vector2(3, 4),
|
||||
throwsA(isA<Error>()),
|
||||
);
|
||||
});
|
||||
|
||||
flameTester.test(
|
||||
'returns normally '
|
||||
'when the body sets the position to initial position',
|
||||
(game) async {
|
||||
final component = TestPositionedBodyComponent()
|
||||
..initialPosition = Vector2.zero();
|
||||
|
||||
await expectLater(
|
||||
() async => game.ensureAdd(component),
|
||||
returnsNormally,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'throws AssertionError '
|
||||
'when not setting initialPosition to body',
|
||||
(game) async {
|
||||
final component = TestBodyComponent()..initialPosition = Vector2.zero();
|
||||
await game.ensureAdd(component);
|
||||
|
||||
await expectLater(
|
||||
() async => game.ensureAdd(component),
|
||||
throwsAssertionError,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
// ignore_for_file: cascade_invocations
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:flame_test/flame_test.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('RoundBumper', () {
|
||||
final flameTester = FlameTester(Forge2DGame.new);
|
||||
const radius = 1.0;
|
||||
const points = 1;
|
||||
|
||||
flameTester.test(
|
||||
'loads correctly',
|
||||
(game) async {
|
||||
await game.ready();
|
||||
final roundBumper = RoundBumper(
|
||||
position: Vector2.zero(),
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
|
||||
expect(game.contains(roundBumper), isTrue);
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has points',
|
||||
(game) async {
|
||||
final roundBumper = RoundBumper(
|
||||
position: Vector2.zero(),
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
|
||||
expect(roundBumper.points, equals(points));
|
||||
},
|
||||
);
|
||||
|
||||
group('body', () {
|
||||
flameTester.test(
|
||||
'positions correctly',
|
||||
(game) async {
|
||||
final position = Vector2.all(10);
|
||||
final roundBumper = RoundBumper(
|
||||
position: position,
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
game.contains(roundBumper);
|
||||
|
||||
expect(roundBumper.body.position, equals(position));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'is static',
|
||||
(game) async {
|
||||
final roundBumper = RoundBumper(
|
||||
position: Vector2.zero(),
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
|
||||
expect(roundBumper.body.bodyType, equals(BodyType.static));
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('fixture', () {
|
||||
flameTester.test(
|
||||
'exists',
|
||||
(game) async {
|
||||
final roundBumper = RoundBumper(
|
||||
position: Vector2.zero(),
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
|
||||
expect(roundBumper.body.fixtures[0], isA<Fixture>());
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has restitution',
|
||||
(game) async {
|
||||
final roundBumper = RoundBumper(
|
||||
position: Vector2.zero(),
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
|
||||
final fixture = roundBumper.body.fixtures[0];
|
||||
expect(fixture.restitution, greaterThan(0));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'shape is circular',
|
||||
(game) async {
|
||||
final roundBumper = RoundBumper(
|
||||
position: Vector2.zero(),
|
||||
radius: radius,
|
||||
points: points,
|
||||
);
|
||||
await game.ensureAdd(roundBumper);
|
||||
|
||||
final fixture = roundBumper.body.fixtures[0];
|
||||
expect(fixture.shape.shapeType, equals(ShapeType.circle));
|
||||
expect(fixture.shape.radius, equals(1));
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
// ignore_for_file: cascade_invocations
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:flame_test/flame_test.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
|
||||
void main() {
|
||||
group('SlingShot', () {
|
||||
final flameTester = FlameTester(Forge2DGame.new);
|
||||
|
||||
flameTester.test(
|
||||
'loads correctly',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
expect(game.contains(slingShot), isTrue);
|
||||
},
|
||||
);
|
||||
|
||||
group('body', () {
|
||||
flameTester.test(
|
||||
'positions correctly',
|
||||
(game) async {
|
||||
final position = Vector2.all(10);
|
||||
final slingShot = SlingShot(
|
||||
position: position,
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
expect(slingShot.body.position, equals(position));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'is static',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
expect(slingShot.body.bodyType, equals(BodyType.static));
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('first fixture', () {
|
||||
flameTester.test(
|
||||
'exists',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
expect(slingShot.body.fixtures[0], isA<Fixture>());
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'shape is triangular',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
final fixture = slingShot.body.fixtures[0];
|
||||
expect(fixture.shape.shapeType, equals(ShapeType.polygon));
|
||||
expect((fixture.shape as PolygonShape).vertices.length, equals(3));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'triangular shapes are different '
|
||||
'when side is left or right',
|
||||
(game) async {
|
||||
final leftSlingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
final rightSlingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.right,
|
||||
);
|
||||
|
||||
await game.ensureAdd(leftSlingShot);
|
||||
await game.ensureAdd(rightSlingShot);
|
||||
|
||||
final rightShape =
|
||||
rightSlingShot.body.fixtures[0].shape as PolygonShape;
|
||||
final leftShape =
|
||||
leftSlingShot.body.fixtures[0].shape as PolygonShape;
|
||||
|
||||
expect(rightShape.vertices, isNot(equals(leftShape.vertices)));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has no friction',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
final fixture = slingShot.body.fixtures[0];
|
||||
expect(fixture.friction, equals(0));
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('second fixture', () {
|
||||
flameTester.test(
|
||||
'exists',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
expect(slingShot.body.fixtures[1], isA<Fixture>());
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'shape is edge',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
final fixture = slingShot.body.fixtures[1];
|
||||
expect(fixture.shape.shapeType, equals(ShapeType.edge));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has restitution',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
final fixture = slingShot.body.fixtures[1];
|
||||
expect(fixture.restitution, greaterThan(0));
|
||||
},
|
||||
);
|
||||
|
||||
flameTester.test(
|
||||
'has no friction',
|
||||
(game) async {
|
||||
final slingShot = SlingShot(
|
||||
position: Vector2.zero(),
|
||||
side: BoardSide.left,
|
||||
);
|
||||
await game.ensureAdd(slingShot);
|
||||
|
||||
final fixture = slingShot.body.fixtures[1];
|
||||
expect(fixture.friction, equals(0));
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in new issue