mirror of https://github.com/flutter/pinball.git
parent
9d2e9dd243
commit
5bee98a2d5
@ -0,0 +1,37 @@
|
|||||||
|
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 LaunchRampGame extends BasicBallGame with Traceable {
|
||||||
|
LaunchRampGame()
|
||||||
|
: super(
|
||||||
|
color: Colors.blue,
|
||||||
|
ballPriority: LaunchRamp.ballPriorityInsideRamp,
|
||||||
|
ballLayer: Layer.launcher,
|
||||||
|
);
|
||||||
|
|
||||||
|
static const info = '''
|
||||||
|
Shows how LaunchRamp 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(0, 0))
|
||||||
|
..zoom = 7.5;
|
||||||
|
|
||||||
|
final launchRamp = LaunchRamp();
|
||||||
|
unawaited(addFromBlueprint(launchRamp));
|
||||||
|
|
||||||
|
await traceAllBodies();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:dashbook/dashbook.dart';
|
||||||
|
import 'package:flame/game.dart';
|
||||||
|
import 'package:sandbox/common/common.dart';
|
||||||
|
import 'package:sandbox/stories/launch_ramp/launch_ramp_game.dart';
|
||||||
|
|
||||||
|
void addLaunchRampStories(Dashbook dashbook) {
|
||||||
|
dashbook.storiesOf('LaunchRamp').add(
|
||||||
|
'Basic',
|
||||||
|
(context) => GameWidget(
|
||||||
|
game: LaunchRampGame()..trace = context.boolProperty('Trace', true),
|
||||||
|
),
|
||||||
|
codeLink: buildSourceLink('launch_ramp/basic.dart'),
|
||||||
|
info: LaunchRampGame.info,
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in new issue