mirror of https://github.com/flutter/pinball.git
parent
ca3612558c
commit
daf3f9e09a
@ -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 SpaceshipRampGame extends BasicBallGame with Traceable {
|
||||
SpaceshipRampGame()
|
||||
: super(
|
||||
color: Colors.blue,
|
||||
ballPriority: SpaceshipRamp.ballPriorityInsideRamp,
|
||||
ballLayer: Layer.spaceshipEntranceRamp,
|
||||
);
|
||||
|
||||
static const info = '''
|
||||
Shows how SpaceshipRamp 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(-10, -20));
|
||||
|
||||
final spaceshipRamp = SpaceshipRamp();
|
||||
unawaited(addFromBlueprint(spaceshipRamp));
|
||||
|
||||
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_ramp/spaceship_ramp_game.dart';
|
||||
|
||||
void addSpaceshipRampStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('SpaceshipRamp').add(
|
||||
'Basic',
|
||||
(context) => GameWidget(
|
||||
game: SpaceshipRampGame()
|
||||
..trace = context.boolProperty('Trace', true),
|
||||
),
|
||||
codeLink: buildSourceLink('spaceship_ramp/basic.dart'),
|
||||
info: SpaceshipRampGame.info,
|
||||
);
|
||||
}
|
Loading…
Reference in new issue