mirror of https://github.com/flutter/pinball.git
parent
4db897196a
commit
f031359439
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
@ -1,4 +1,6 @@
|
||||
import 'package:pinball/game/game.dart';
|
||||
// ignore_for_file: comment_references
|
||||
// TODO(allisonryan0002): Revisit ignore lint rule once Kicker is moved to this
|
||||
// package.
|
||||
|
||||
/// Indicates a side of the board.
|
||||
///
|
@ -0,0 +1,15 @@
|
||||
import 'package:dashbook/dashbook.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/baseboard/basic.dart';
|
||||
|
||||
void addBaseboardStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('Baseboard').add(
|
||||
'Basic',
|
||||
(context) => GameWidget(
|
||||
game: BasicBaseboardGame(),
|
||||
),
|
||||
codeLink: buildSourceLink('baseboard/basic.dart'),
|
||||
info: BasicBaseboardGame.info,
|
||||
);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
|
||||
class BasicBaseboardGame extends BasicGame {
|
||||
static const info = '''
|
||||
Basic example of how a Baseboard works.
|
||||
''';
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
|
||||
final center = screenToWorld(camera.viewport.canvasSize! / 2);
|
||||
|
||||
final leftBaseboard = Baseboard(side: BoardSide.left)
|
||||
..initialPosition = center - Vector2(Baseboard.size.x, 0);
|
||||
final rightBaseboard = Baseboard(side: BoardSide.right)
|
||||
..initialPosition = center + Vector2(Baseboard.size.x, 0);
|
||||
|
||||
await addAll([
|
||||
leftBaseboard,
|
||||
rightBaseboard,
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,2 +1,4 @@
|
||||
export 'ball/ball.dart';
|
||||
export 'baseboard/baseboard.dart';
|
||||
export 'effects/effects.dart';
|
||||
export 'layer/layer.dart';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pinball/game/game.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
|
||||
void main() {
|
||||
group(
|
Loading…
Reference in new issue