fix: PR suggestions

pull/365/head
Allison Ryan 3 years ago
parent 4c342d5144
commit cdeb4592f2

@ -19,17 +19,16 @@ class SparkyComputerSensorBallContactBehavior
await parent.add( await parent.add(
TimerComponent( TimerComponent(
period: 1.5, period: 1.5,
onTick: () { removeOnFinish: true,
other onTick: () async {
..resume() other.resume();
..add( await other.add(
BallTurboChargingBehavior( BallTurboChargingBehavior(
impulse: Vector2(40, 110), impulse: Vector2(40, 110),
), ),
); );
parent.bloc.onBallTurboCharged(); parent.bloc.onBallTurboCharged();
}, },
removeOnFinish: true,
), ),
); );
} }

@ -73,17 +73,16 @@ class SparkyComputer extends BodyComponent {
Vector2(-13.2, -49.9), Vector2(-13.2, -49.9),
-0.18, -0.18,
); );
final turboChargeSensorFixtureDef = FixtureDef(
turboChargeSensor,
isSensor: true,
userData: 'turbo_charge_sensor',
);
return [ return [
FixtureDef(leftEdge), FixtureDef(leftEdge),
FixtureDef(topEdge), FixtureDef(topEdge),
FixtureDef(rightEdge), FixtureDef(rightEdge),
turboChargeSensorFixtureDef, FixtureDef(
turboChargeSensor,
isSensor: true,
userData: 'turbo_charge_sensor',
),
]; ];
} }

@ -126,7 +126,9 @@ void main() {
final ball = _MockBall(); final ball = _MockBall();
await behavior.beginContact(ball, _MockContact()); await behavior.beginContact(ball, _MockContact());
await game.ready(); await game.ready();
game.update(2); game.update(
sparkyComputer.firstChild<TimerComponent>()!.timer.limit,
);
await game.ready(); await game.ready();
verify(ball.resume).called(1); verify(ball.resume).called(1);

Loading…
Cancel
Save