refactor: added priority and layer to Ball for BasicBallGame

pull/168/head
RuiAlonso 4 years ago
parent 3529b411fd
commit 278d641f3a

@ -4,7 +4,11 @@ import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart'; import 'package:sandbox/common/common.dart';
class BasicBallGame extends BasicGame with TapDetector { class BasicBallGame extends BasicGame with TapDetector {
BasicBallGame({required this.color}); BasicBallGame({
required this.color,
this.ballPriority = 0,
this.ballLayer = Layer.all,
});
static const info = ''' static const info = '''
Shows how a Ball works. Shows how a Ball works.
@ -13,11 +17,16 @@ class BasicBallGame extends BasicGame with TapDetector {
'''; ''';
final Color color; final Color color;
final int ballPriority;
final Layer ballLayer;
@override @override
void onTapUp(TapUpInfo info) { void onTapUp(TapUpInfo info) {
add( add(
Ball(baseColor: color)..initialPosition = info.eventPosition.game, Ball(baseColor: color)
..initialPosition = info.eventPosition.game
..layer = ballLayer
..priority = ballPriority,
); );
} }
} }

Loading…
Cancel
Save