feat: added SpaceshipRail story

pull/168/head
RuiAlonso 4 years ago
parent 5bee98a2d5
commit ca3612558c

@ -0,0 +1,35 @@
import 'dart:async';
import 'package:flame/input.dart';
import 'package:flutter/material.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
class SpaceshipRailGame extends BasicBallGame with Traceable {
SpaceshipRailGame()
: super(
color: Colors.blue,
ballPriority: SpaceshipRail.ballPriorityInsideRail,
ballLayer: Layer.spaceshipExitRail,
);
static const info = '''
Shows how SpaceshipRail are rendered.
- Activate the "trace" parameter to overlay the body.
- Tap anywhere on the screen to spawn a ball into the game.
''';
@override
Future<void> onLoad() async {
await super.onLoad();
camera.followVector2(Vector2(-30, -10));
final spaceshipRail = SpaceshipRail();
unawaited(addFromBlueprint(spaceshipRail));
await traceAllBodies();
}
}

@ -0,0 +1,16 @@
import 'package:dashbook/dashbook.dart';
import 'package:flame/game.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/spaceship_rail/spaceship_rail_game.dart';
void addSpaceshipRailStories(Dashbook dashbook) {
dashbook.storiesOf('SpaceshipRail').add(
'Basic',
(context) => GameWidget(
game: SpaceshipRailGame()
..trace = context.boolProperty('Trace', true),
),
codeLink: buildSourceLink('spaceship_rail/basic.dart'),
info: SpaceshipRailGame.info,
);
}
Loading…
Cancel
Save