Merge branch 'main' into feat/add-sparky-fire-zone

pull/165/head
RuiAlonso 4 years ago
commit d3c946334e

@ -12,11 +12,14 @@ class Board extends Component {
@override
Future<void> onLoad() async {
// TODO(allisonryan0002): add bottom group and flutter forest to pinball
// game directly. Then remove board.
final bottomGroup = _BottomGroup();
final flutterForest = FlutterForest();
// TODO(alestiago): adjust positioning to real design.
// TODO(alestiago): add dino in pinball game.
final dino = ChromeDino()
..initialPosition = Vector2(
BoardDimensions.bounds.center.dx + 25,
@ -74,7 +77,7 @@ class _BottomGroupSide extends Component {
final flipper = ControlledFlipper(
side: _side,
)..initialPosition = Vector2((11.0 * direction) + centerXAdjustment, -42.4);
)..initialPosition = Vector2((11.8 * direction) + centerXAdjustment, -43.6);
final baseboard = Baseboard(side: _side)
..initialPosition = Vector2(
(25.58 * direction) + centerXAdjustment,

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:math' as math;
import 'package:flame/components.dart';
import 'package:flame_forge2d/flame_forge2d.dart';
@ -198,8 +197,8 @@ class _FlipperJoint extends RevoluteJoint {
lock();
}
/// The total angle of the arc motion.
static const _sweepingAngle = math.pi / 3.5;
/// Half the angle of the arc motion.
static const _halfSweepingAngle = 0.611;
final BoardSide side;
@ -208,7 +207,7 @@ class _FlipperJoint extends RevoluteJoint {
/// The joint is locked when initialized in order to force the [Flipper]
/// at its resting position.
void lock() {
const angle = _sweepingAngle / 2;
const angle = _halfSweepingAngle;
setLimits(
-angle * side.direction,
-angle * side.direction,
@ -217,7 +216,7 @@ class _FlipperJoint extends RevoluteJoint {
/// Unlocks the [Flipper] from its resting position.
void unlock() {
const angle = _sweepingAngle / 2;
const angle = _halfSweepingAngle;
setLimits(-angle, angle);
}
}

@ -1,17 +0,0 @@
import 'package:dashbook/dashbook.dart';
import 'package:flame/game.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
import 'package:sandbox/stories/dash_nest_bumper/big_dash_nest_bumper_game.dart';
void addDashNestBumperStories(Dashbook dashbook) {
dashbook.storiesOf('Dash Nest Bumpers').add(
'Big',
(context) => GameWidget(
game: BigDashNestBumperGame()
..trace = context.boolProperty('Trace', true),
),
codeLink: buildSourceLink('dash_nest_bumper/big.dart'),
info: BasicBallGame.info,
);
}

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:ui';
import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
@ -11,19 +12,15 @@ class BigDashNestBumperGame extends BasicBallGame with Traceable {
static const info = '''
Shows how a BigDashNestBumper is rendered.
Activate the "trace" parameter to overlay the body.
- Activate the "trace" parameter to overlay the body.
''';
@override
Future<void> onLoad() async {
await super.onLoad();
final center = screenToWorld(camera.viewport.canvasSize! / 2);
final bigDashNestBumper = BigDashNestBumper()
..initialPosition = center
..priority = 1;
await add(bigDashNestBumper);
camera.followVector2(Vector2.zero());
await add(BigDashNestBumper()..priority = 1);
await traceAllBodies();
await traceAllBodies();
}
}

@ -0,0 +1,25 @@
import 'dart:async';
import 'dart:ui';
import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
class FlutterSignPostGame extends BasicBallGame with Traceable {
FlutterSignPostGame() : super(color: const Color(0xFF0000FF));
static const info = '''
Shows how a FlutterSignPost is rendered.
- Activate the "trace" parameter to overlay the body.
''';
@override
Future<void> onLoad() async {
await super.onLoad();
camera.followVector2(Vector2.zero());
await add(FlutterSignPost()..priority = 1);
await traceAllBodies();
}
}

@ -0,0 +1,26 @@
import 'dart:async';
import 'dart:ui';
import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
class SmallDashNestBumperAGame extends BasicBallGame with Traceable {
SmallDashNestBumperAGame() : super(color: const Color(0xFF0000FF));
static const info = '''
Shows how a SmallDashNestBumper ("a") is rendered.
- Activate the "trace" parameter to overlay the body.
''';
@override
Future<void> onLoad() async {
await super.onLoad();
camera.followVector2(Vector2.zero());
await add(SmallDashNestBumper.a()..priority = 1);
await traceAllBodies();
await traceAllBodies();
}
}

@ -0,0 +1,26 @@
import 'dart:async';
import 'dart:ui';
import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
class SmallDashNestBumperBGame extends BasicBallGame with Traceable {
SmallDashNestBumperBGame() : super(color: const Color(0xFF0000FF));
static const info = '''
Shows how a SmallDashNestBumper ("b") is rendered.
- Activate the "trace" parameter to overlay the body.
''';
@override
Future<void> onLoad() async {
await super.onLoad();
camera.followVector2(Vector2.zero());
await add(SmallDashNestBumper.b()..priority = 1);
await traceAllBodies();
await traceAllBodies();
}
}

@ -0,0 +1,47 @@
import 'package:dashbook/dashbook.dart';
import 'package:flame/game.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/flutter_forest/big_dash_nest_bumper_game.dart';
import 'package:sandbox/stories/flutter_forest/flutter_sign_post_game.dart';
import 'package:sandbox/stories/flutter_forest/small_dash_nest_bumper_a_game.dart';
import 'package:sandbox/stories/flutter_forest/small_dash_nest_bumper_b_game.dart';
void addDashNestBumperStories(Dashbook dashbook) {
dashbook.storiesOf('Flutter Forest')
..add(
'Flutter Sign Post',
(context) => GameWidget(
game: FlutterSignPostGame()
..trace = context.boolProperty('Trace', true),
),
codeLink: buildSourceLink('flutter_forest/flutter_sign_post.dart'),
info: FlutterSignPostGame.info,
)
..add(
'Big Dash Nest Bumper',
(context) => GameWidget(
game: BigDashNestBumperGame()
..trace = context.boolProperty('Trace', true),
),
codeLink: buildSourceLink('flutter_forest/big_dash_nest_bumper.dart'),
info: BigDashNestBumperGame.info,
)
..add(
'Small Dash Nest Bumper A',
(context) => GameWidget(
game: SmallDashNestBumperAGame()
..trace = context.boolProperty('Trace', true),
),
codeLink: buildSourceLink('flutter_forest/small_dash_nest_bumper_a.dart'),
info: SmallDashNestBumperAGame.info,
)
..add(
'Small Dash Nest Bumper B',
(context) => GameWidget(
game: SmallDashNestBumperBGame()
..trace = context.boolProperty('Trace', true),
),
codeLink: buildSourceLink('flutter_forest/small_dash_nest_bumper_b.dart'),
info: SmallDashNestBumperBGame.info,
);
}

@ -1,9 +1,9 @@
export 'ball/stories.dart';
export 'baseboard/stories.dart';
export 'chrome_dino/stories.dart';
export 'dash_nest_bumper/stories.dart';
export 'effects/stories.dart';
export 'flipper/stories.dart';
export 'flutter_forest/stories.dart';
export 'layer/stories.dart';
export 'slingshot/stories.dart';
export 'spaceship/stories.dart';

Loading…
Cancel
Save