mirror of https://github.com/flutter/pinball.git
parent
72b8213f74
commit
9c11113c58
After Width: | Height: | Size: 231 KiB |
After Width: | Height: | Size: 38 KiB |
@ -0,0 +1 @@
|
||||
export 'blueprint.dart';
|
@ -1 +1,2 @@
|
||||
export 'components/components.dart';
|
||||
export 'flame/flame.dart';
|
||||
|
@ -0,0 +1,31 @@
|
||||
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';
|
||||
|
||||
class BasicSpaceship extends BasicGame with TapDetector {
|
||||
static String info = 'Renders a spaceship and allows balls to be '
|
||||
'spawned upon click to test their interactions';
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
|
||||
camera.followVector2(Vector2.zero());
|
||||
|
||||
unawaited(
|
||||
addFromBlueprint(Spaceship(position: Vector2.zero())),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTapUp(TapUpInfo info) {
|
||||
add(
|
||||
Ball(baseColor: Colors.blue)
|
||||
..initialPosition = info.eventPosition.game
|
||||
..layer = Layer.jetpack,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import 'package:dashbook/dashbook.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:sandbox/common/common.dart';
|
||||
import 'package:sandbox/stories/spaceship/basic.dart';
|
||||
|
||||
void addSpaceshipStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('Spaceship').add(
|
||||
'Basic',
|
||||
(context) => GameWidget(game: BasicSpaceship()),
|
||||
codeLink: buildSourceLink('spaceship/basic.dart'),
|
||||
info: BasicSpaceship.info,
|
||||
);
|
||||
}
|
@ -1,5 +1,26 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:pinball_components/pinball_components.dart';
|
||||
|
||||
class MockCanvas extends Mock implements Canvas {}
|
||||
|
||||
class MockFilter extends Mock implements Filter {}
|
||||
|
||||
class MockFixture extends Mock implements Fixture {}
|
||||
|
||||
class MockBody extends Mock implements Body {}
|
||||
|
||||
class MockBall extends Mock implements Ball {}
|
||||
|
||||
class MockGame extends Mock implements Forge2DGame {}
|
||||
|
||||
class MockSpaceshipEntrance extends Mock implements SpaceshipEntrance {}
|
||||
|
||||
class MockSpaceshipHole extends Mock implements SpaceshipHole {}
|
||||
|
||||
class MockContact extends Mock implements Contact {}
|
||||
|
||||
class MockContactCallback extends Mock
|
||||
implements ContactCallback<Object, Object> {}
|
||||
|
Loading…
Reference in new issue