mirror of https://github.com/flutter/pinball.git
parent
803f5e26c8
commit
ad7f1a05ed
@ -1,15 +0,0 @@
|
|||||||
import 'package:dashbook/dashbook.dart';
|
|
||||||
import 'package:flame/game.dart';
|
|
||||||
import 'package:sandbox/common/common.dart';
|
|
||||||
import 'package:sandbox/stories/alien_bumper/alien_bumper_game.dart';
|
|
||||||
|
|
||||||
void addAlienBumperStories(Dashbook dashbook) {
|
|
||||||
dashbook.storiesOf('Alien Bumpers').add(
|
|
||||||
'Basic',
|
|
||||||
(context) => GameWidget(
|
|
||||||
game: AlienBumperGame()..trace = context.boolProperty('Trace', true),
|
|
||||||
),
|
|
||||||
codeLink: buildSourceLink('alien_bumper/basic.dart'),
|
|
||||||
info: AlienBumperGame.info,
|
|
||||||
);
|
|
||||||
}
|
|
@ -0,0 +1,28 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flame/extensions.dart';
|
||||||
|
import 'package:pinball_components/pinball_components.dart';
|
||||||
|
import 'package:sandbox/stories/ball/basic_ball_game.dart';
|
||||||
|
|
||||||
|
class AlienBumperAGame extends BasicBallGame {
|
||||||
|
AlienBumperAGame() : super(color: const Color(0xFF0000FF));
|
||||||
|
|
||||||
|
static const info = '''
|
||||||
|
Shows how a AlienBumperA is rendered.
|
||||||
|
|
||||||
|
- Activate the "trace" parameter to overlay the body.
|
||||||
|
''';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onLoad() async {
|
||||||
|
await super.onLoad();
|
||||||
|
|
||||||
|
final center = screenToWorld(camera.viewport.canvasSize! / 2);
|
||||||
|
final alienBumperA = AlienBumper.a()
|
||||||
|
..initialPosition = Vector2(center.x - 20, center.y - 20)
|
||||||
|
..priority = 1;
|
||||||
|
await add(alienBumperA);
|
||||||
|
|
||||||
|
await traceAllBodies();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:dashbook/dashbook.dart';
|
||||||
|
import 'package:flame/game.dart';
|
||||||
|
import 'package:sandbox/common/common.dart';
|
||||||
|
import 'package:sandbox/stories/alien_zone/alien_bumper_a_game.dart';
|
||||||
|
import 'package:sandbox/stories/alien_zone/alien_bumper_b_game.dart';
|
||||||
|
|
||||||
|
void addAlienZoneStories(Dashbook dashbook) {
|
||||||
|
dashbook.storiesOf('Alien Zone')
|
||||||
|
..add(
|
||||||
|
'Alien Bumper A',
|
||||||
|
(context) => GameWidget(
|
||||||
|
game: AlienBumperAGame()..trace = context.boolProperty('Trace', true),
|
||||||
|
),
|
||||||
|
codeLink: buildSourceLink('alien_zone/alien_bumper_a.dart'),
|
||||||
|
info: AlienBumperAGame.info,
|
||||||
|
)
|
||||||
|
..add(
|
||||||
|
'Alien Bumper B',
|
||||||
|
(context) => GameWidget(
|
||||||
|
game: AlienBumperBGame()..trace = context.boolProperty('Trace', true),
|
||||||
|
),
|
||||||
|
codeLink: buildSourceLink('alien_zone/alien_bumper_b.dart'),
|
||||||
|
info: AlienBumperAGame.info,
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in new issue