|
|
|
@ -8,10 +8,15 @@ class BallGame extends AssetsGame with TapDetector, Traceable {
|
|
|
|
|
this.color = Colors.blue,
|
|
|
|
|
this.ballPriority = 0,
|
|
|
|
|
this.ballLayer = Layer.all,
|
|
|
|
|
this.character,
|
|
|
|
|
List<String>? imagesFileNames,
|
|
|
|
|
}) : super(
|
|
|
|
|
imagesFileNames: [
|
|
|
|
|
Assets.images.ball.ball.keyName,
|
|
|
|
|
Assets.images.ball.androidBall.keyName,
|
|
|
|
|
Assets.images.ball.dashBall.keyName,
|
|
|
|
|
Assets.images.ball.dinoBall.keyName,
|
|
|
|
|
Assets.images.ball.sparkyBall.keyName,
|
|
|
|
|
if (imagesFileNames != null) ...imagesFileNames,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
@ -22,14 +27,25 @@ class BallGame extends AssetsGame with TapDetector, Traceable {
|
|
|
|
|
- Tap anywhere on the screen to spawn a ball into the game.
|
|
|
|
|
''';
|
|
|
|
|
|
|
|
|
|
static final characterBallPaths = <String, String>{
|
|
|
|
|
'Dash': Assets.images.ball.dashBall.keyName,
|
|
|
|
|
'Sparky': Assets.images.ball.sparkyBall.keyName,
|
|
|
|
|
'Android': Assets.images.ball.androidBall.keyName,
|
|
|
|
|
'Dino': Assets.images.ball.dinoBall.keyName,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
final Color color;
|
|
|
|
|
final int ballPriority;
|
|
|
|
|
final Layer ballLayer;
|
|
|
|
|
final String? character;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void onTapUp(TapUpInfo info) {
|
|
|
|
|
add(
|
|
|
|
|
Ball(baseColor: color)
|
|
|
|
|
Ball(
|
|
|
|
|
baseColor: color,
|
|
|
|
|
spriteAsset: characterBallPaths[character],
|
|
|
|
|
)
|
|
|
|
|
..initialPosition = info.eventPosition.game
|
|
|
|
|
..layer = ballLayer
|
|
|
|
|
..priority = ballPriority,
|
|
|
|
|