refactor: rename RoundBumper to DashNestBumper

pull/89/head
alestiago 4 years ago
parent baab7f65c4
commit b02070c941

@ -3,7 +3,7 @@ import 'package:pinball/game/game.dart';
/// {@template board}
/// The main flat surface of the [PinballGame], where the [Flipper]s,
/// [RoundBumper]s, [Kicker]s are arranged.
/// [DashNestBumper]s, [Kicker]s are arranged.
/// {entemplate}
class Board extends Component {
/// {@macro board}
@ -36,7 +36,7 @@ class Board extends Component {
/// {@template flutter_forest}
/// Area positioned at the top right of the [Board] where the [Ball]
/// can bounce off [RoundBumper]s.
/// can bounce off [DashNestBumper]s.
/// {@endtemplate}
class _FlutterForest extends Component {
/// {@macro flutter_forest}
@ -50,15 +50,15 @@ class _FlutterForest extends Component {
Future<void> onLoad() async {
// TODO(alestiago): adjust positioning once sprites are added.
// TODO(alestiago): Use [NestBumper] instead of [RoundBumper] once provided.
final smallLeftNest = RoundBumper(
final smallLeftNest = DashNestBumper(
radius: 1,
points: 10,
)..initialPosition = position + Vector2(-4.8, 2.8);
final smallRightNest = RoundBumper(
final smallRightNest = DashNestBumper(
radius: 1,
points: 10,
)..initialPosition = position + Vector2(0.5, -5.5);
final bigNest = RoundBumper(
final bigNest = DashNestBumper(
radius: 2,
points: 20,
)..initialPosition = position;

@ -1,21 +1,21 @@
import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:pinball/game/game.dart';
/// {@template round_bumper}
/// {@template dash_nest_bumper}
/// Circular body that repels a [Ball] on contact, increasing the score.
/// {@endtemplate}
class RoundBumper extends BodyComponent with ScorePoints, InitialPosition {
/// {@macro round_bumper}
RoundBumper({
class DashNestBumper extends BodyComponent with ScorePoints, InitialPosition {
/// {@macro dash_nest_bumper}
DashNestBumper({
required double radius,
required int points,
}) : _radius = radius,
_points = points;
/// The radius of the [RoundBumper].
/// The radius of the [DashNestBumper].
final double _radius;
/// Points awarded from hitting this [RoundBumper].
/// Points awarded from hitting this [DashNestBumper].
final int _points;
@override
@ -24,7 +24,6 @@ class RoundBumper extends BodyComponent with ScorePoints, InitialPosition {
@override
Body createBody() {
final shape = CircleShape()..radius = _radius;
final fixtureDef = FixtureDef(shape)..restitution = 1;
final bodyDef = BodyDef()..position = initialPosition;

@ -82,7 +82,7 @@ void main() {
await game.ready();
await game.ensureAdd(board);
final roundBumpers = board.descendants().whereType<RoundBumper>();
final roundBumpers = board.descendants().whereType<DashNestBumper>();
expect(roundBumpers.length, equals(3));
},
);

@ -17,7 +17,7 @@ void main() {
'loads correctly',
(game) async {
await game.ready();
final roundBumper = RoundBumper(
final roundBumper = DashNestBumper(
radius: radius,
points: points,
);
@ -30,7 +30,7 @@ void main() {
flameTester.test(
'has points',
(game) async {
final roundBumper = RoundBumper(
final roundBumper = DashNestBumper(
radius: radius,
points: points,
);
@ -44,7 +44,7 @@ void main() {
flameTester.test(
'is static',
(game) async {
final roundBumper = RoundBumper(
final roundBumper = DashNestBumper(
radius: radius,
points: points,
);
@ -59,7 +59,7 @@ void main() {
flameTester.test(
'exists',
(game) async {
final roundBumper = RoundBumper(
final roundBumper = DashNestBumper(
radius: radius,
points: points,
);
@ -72,7 +72,7 @@ void main() {
flameTester.test(
'has restitution',
(game) async {
final roundBumper = RoundBumper(
final roundBumper = DashNestBumper(
radius: radius,
points: points,
);
@ -86,7 +86,7 @@ void main() {
flameTester.test(
'shape is circular',
(game) async {
final roundBumper = RoundBumper(
final roundBumper = DashNestBumper(
radius: radius,
points: points,
);

Loading…
Cancel
Save