feat: pr suggestion

pull/170/head
Erick Zanardo 4 years ago
parent 513f7c52c7
commit fc4dcd9186

@ -16,10 +16,10 @@ class ScoreEffectController extends ComponentController<PinballGame>
ScoreEffectController(PinballGame component) : super(component); ScoreEffectController(PinballGame component) : super(component);
int _lastScore = 0; int _lastScore = 0;
final _rng = Random(); final _random = Random();
double _noise() { double _noise() {
return _rng.nextDouble() * 5 * (_rng.nextBool() ? -1 : 1); return _random.nextDouble() * 5 * (_random.nextBool() ? -1 : 1);
} }
@override @override

@ -11,7 +11,7 @@ class ScoreTextEffectBasicGame extends BasicGame with TapDetector {
simply tap on the screen to spawn an effect on the given location. simply tap on the screen to spawn an effect on the given location.
'''; ''';
final rng = Random(); final random = Random();
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
@ -22,7 +22,7 @@ class ScoreTextEffectBasicGame extends BasicGame with TapDetector {
void onTapUp(TapUpInfo info) { void onTapUp(TapUpInfo info) {
add( add(
ScoreTextEffect( ScoreTextEffect(
text: rng.nextInt(100000).toString(), text: random.nextInt(100000).toString(),
color: Colors.white, color: Colors.white,
position: info.eventPosition.game..multiply(Vector2(1, -1)), position: info.eventPosition.game..multiply(Vector2(1, -1)),
), ),

Loading…
Cancel
Save