mirror of https://github.com/flutter/pinball.git
parent
166b825a9d
commit
8861da0827
@ -0,0 +1,31 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flame/components.dart';
|
||||||
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
||||||
|
import 'package:pinball_components/pinball_components.dart';
|
||||||
|
import 'package:sandbox/common/common.dart';
|
||||||
|
|
||||||
|
class FlipperTracingGame extends BasicGame {
|
||||||
|
static const info = '''
|
||||||
|
Basic example of how a Flipper works.
|
||||||
|
''';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> onLoad() async {
|
||||||
|
await super.onLoad();
|
||||||
|
|
||||||
|
final center = screenToWorld(camera.viewport.canvasSize! / 2);
|
||||||
|
|
||||||
|
final leftFlipper = Flipper(side: BoardSide.left)
|
||||||
|
..initialPosition = center - Vector2(Flipper.size.x, 0);
|
||||||
|
|
||||||
|
await addAll([
|
||||||
|
leftFlipper,
|
||||||
|
]);
|
||||||
|
|
||||||
|
leftFlipper.body.joints.whereType<RevoluteJoint>().forEach(
|
||||||
|
(joint) => joint.setLimits(0, 0),
|
||||||
|
);
|
||||||
|
leftFlipper.removeAll(leftFlipper.children);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue