feat: add hole in dino wall (#306)

* feat: add mouse hole in dino wall

* style: trailing comma
pull/310/head
Allison Ryan 2 years ago committed by GitHub
parent 36f7886f63
commit 3e10c5850d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,7 +40,7 @@ class FlutterForestBonusBehavior extends Component
.add(const BonusActivated(GameBonus.dashNest));
canvas.add(
ControlledBall.bonus(characterTheme: gameRef.characterTheme)
..initialPosition = Vector2(17.2, -52.7),
..initialPosition = Vector2(29.5, -24.5),
);
animatronic.playing = true;
signpost.bloc.onProgressed();

@ -38,6 +38,7 @@ extension PinballGameAssetsX on PinballGame {
),
images.load(components.Assets.images.dino.bottomWall.keyName),
images.load(components.Assets.images.dino.topWall.keyName),
images.load(components.Assets.images.dino.topWallTunnel.keyName),
images.load(components.Assets.images.dino.animatronic.head.keyName),
images.load(components.Assets.images.dino.animatronic.mouth.keyName),
images.load(components.Assets.images.dash.animatronic.keyName),

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 28 KiB

@ -124,6 +124,10 @@ class $AssetsImagesDinoGen {
AssetGenImage get bottomWall =>
const AssetGenImage('assets/images/dino/bottom-wall.png');
/// File path: assets/images/dino/top-wall-tunnel.png
AssetGenImage get topWallTunnel =>
const AssetGenImage('assets/images/dino/top-wall-tunnel.png');
/// File path: assets/images/dino/top-wall.png
AssetGenImage get topWall =>
const AssetGenImage('assets/images/dino/top-wall.png');

@ -23,59 +23,70 @@ class DinoWalls extends Component {
/// {@template dino_top_wall}
/// Wall segment located above [ChromeDino].
/// {@endtemplate}
class _DinoTopWall extends BodyComponent with InitialPosition, ZIndex {
class _DinoTopWall extends BodyComponent with InitialPosition {
///{@macro dino_top_wall}
_DinoTopWall()
: super(
children: [_DinoTopWallSpriteComponent()],
children: [
_DinoTopWallSpriteComponent(),
_DinoTopWallTunnelSpriteComponent(),
],
renderBody: false,
) {
zIndex = ZIndexes.dinoTopWall;
}
);
List<FixtureDef> _createFixtureDefs() {
final topStraightShape = EdgeShape()
final topEdgeShape = EdgeShape()
..set(
Vector2(28.65, -34.3),
Vector2(29.5, -34.3),
Vector2(29.25, -35.27),
Vector2(28.4, -34.77),
);
final topCurveShape = BezierCurveShape(
controlPoints: [
topStraightShape.vertex1,
Vector2(18.8, -26.2),
Vector2(26.6, -20.2),
topEdgeShape.vertex2,
Vector2(21.35, -28.72),
Vector2(23.45, -24.62),
],
);
final middleCurveShape = BezierCurveShape(
controlPoints: [
final tunnelTopEdgeShape = EdgeShape()
..set(
topCurveShape.vertices.last,
Vector2(27.8, -19.3),
Vector2(26.8, -18.7),
],
);
Vector2(30.35, -27.32),
);
final bottomCurveShape = BezierCurveShape(
controlPoints: [
middleCurveShape.vertices.last,
Vector2(23, -14.2),
Vector2(27, -14.2),
],
);
final tunnelBottomEdgeShape = EdgeShape()
..set(
Vector2(30.75, -23.17),
Vector2(25.45, -21.22),
);
final bottomStraightShape = EdgeShape()
final middleEdgeShape = EdgeShape()
..set(
bottomCurveShape.vertices.last,
Vector2(31, -13.7),
tunnelBottomEdgeShape.vertex2,
Vector2(27.45, -19.32),
);
final bottomEdgeShape = EdgeShape()
..set(
middleEdgeShape.vertex2,
Vector2(24.65, -15.02),
);
final undersideEdgeShape = EdgeShape()
..set(
bottomEdgeShape.vertex2,
Vector2(31.75, -13.77),
);
return [
FixtureDef(topStraightShape),
FixtureDef(topEdgeShape),
FixtureDef(topCurveShape),
FixtureDef(middleCurveShape),
FixtureDef(bottomCurveShape),
FixtureDef(bottomStraightShape),
FixtureDef(tunnelTopEdgeShape),
FixtureDef(tunnelBottomEdgeShape),
FixtureDef(middleEdgeShape),
FixtureDef(bottomEdgeShape),
FixtureDef(undersideEdgeShape),
];
}
@ -93,7 +104,15 @@ class _DinoTopWall extends BodyComponent with InitialPosition, ZIndex {
}
}
class _DinoTopWallSpriteComponent extends SpriteComponent with HasGameRef {
class _DinoTopWallSpriteComponent extends SpriteComponent
with HasGameRef, ZIndex {
_DinoTopWallSpriteComponent()
: super(
position: Vector2(22.75, -38.07),
) {
zIndex = ZIndexes.dinoTopWall;
}
@override
Future<void> onLoad() async {
await super.onLoad();
@ -104,7 +123,26 @@ class _DinoTopWallSpriteComponent extends SpriteComponent with HasGameRef {
);
this.sprite = sprite;
size = sprite.originalSize / 10;
position = Vector2(22.8, -38.1);
}
}
class _DinoTopWallTunnelSpriteComponent extends SpriteComponent
with HasGameRef, ZIndex {
_DinoTopWallTunnelSpriteComponent()
: super(position: Vector2(23.31, -26.01)) {
zIndex = ZIndexes.dinoTopWallTunnel;
}
@override
Future<void> onLoad() async {
await super.onLoad();
final sprite = Sprite(
gameRef.images.fromCache(
Assets.images.dino.topWallTunnel.keyName,
),
);
this.sprite = sprite;
size = sprite.originalSize / 10;
}
}
@ -122,7 +160,7 @@ class _DinoBottomWall extends BodyComponent with InitialPosition, ZIndex {
}
List<FixtureDef> _createFixtureDefs() {
final topStraightShape = EdgeShape()
final topEdgeShape = EdgeShape()
..set(
Vector2(32.4, -8.8),
Vector2(25, -7.7),
@ -130,29 +168,29 @@ class _DinoBottomWall extends BodyComponent with InitialPosition, ZIndex {
final topLeftCurveShape = BezierCurveShape(
controlPoints: [
topStraightShape.vertex2,
topEdgeShape.vertex2,
Vector2(21.8, -7),
Vector2(29.8, 13.8),
],
);
final bottomLeftStraightShape = EdgeShape()
final bottomLeftEdgeShape = EdgeShape()
..set(
topLeftCurveShape.vertices.last,
Vector2(31.9, 44.1),
);
final bottomStraightShape = EdgeShape()
final bottomEdgeShape = EdgeShape()
..set(
bottomLeftStraightShape.vertex2,
bottomLeftEdgeShape.vertex2,
Vector2(37.8, 44.1),
);
return [
FixtureDef(topStraightShape),
FixtureDef(topEdgeShape),
FixtureDef(topLeftCurveShape),
FixtureDef(bottomLeftStraightShape),
FixtureDef(bottomStraightShape),
FixtureDef(bottomLeftEdgeShape),
FixtureDef(bottomEdgeShape),
];
}

@ -53,6 +53,8 @@ abstract class ZIndexes {
static const dinoTopWall = _above + ballOnBoard;
static const dinoTopWallTunnel = _below + ballOnBoard;
static const dino = _above + dinoTopWall;
static const dinoBottomWall = _above + dino;

@ -14,19 +14,17 @@ void main() {
addBallStories(dashbook);
addLayerStories(dashbook);
addEffectsStories(dashbook);
addChromeDinoStories(dashbook);
addFlutterForestStories(dashbook);
addBottomGroupStories(dashbook);
addPlungerStories(dashbook);
addSlingshotStories(dashbook);
addSparkyScorchStories(dashbook);
addAndroidAcresStories(dashbook);
addDinoDesertStories(dashbook);
addBottomGroupStories(dashbook);
addPlungerStories(dashbook);
addBoundariesStories(dashbook);
addGoogleWordStories(dashbook);
addLaunchRampStories(dashbook);
addScoreStories(dashbook);
addBackboardStories(dashbook);
addDinoWallStories(dashbook);
addMultiballStories(dashbook);
addMultipliersStories(dashbook);

@ -1,11 +0,0 @@
import 'package:dashbook/dashbook.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/chrome_dino/chrome_dino_game.dart';
void addChromeDinoStories(Dashbook dashbook) {
dashbook.storiesOf('Chrome Dino').addGame(
title: 'Traced',
description: ChromeDinoGame.description,
gameBuilder: (_) => ChromeDinoGame(),
);
}

@ -4,8 +4,8 @@ import 'package:flame/input.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
class DinoWallGame extends BallGame {
DinoWallGame() : super();
class DinoWallsGame extends BallGame {
DinoWallsGame() : super();
static const description = '''
Shows how DinoWalls are rendered.
@ -20,6 +20,7 @@ class DinoWallGame extends BallGame {
await images.loadAll([
Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName,
]);

@ -2,8 +2,8 @@ import 'package:flame/extensions.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart';
class SlingshotGame extends BallGame {
SlingshotGame()
class SlingshotsGame extends BallGame {
SlingshotsGame()
: super(
imagesFileNames: [
Assets.images.slingshot.upper.keyName,

@ -0,0 +1,24 @@
import 'package:dashbook/dashbook.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/dino_desert/chrome_dino_game.dart';
import 'package:sandbox/stories/dino_desert/dino_walls_game.dart';
import 'package:sandbox/stories/dino_desert/slingshots_game.dart';
void addDinoDesertStories(Dashbook dashbook) {
dashbook.storiesOf('Dino Desert')
..addGame(
title: 'Chrome Dino',
description: ChromeDinoGame.description,
gameBuilder: (_) => ChromeDinoGame(),
)
..addGame(
title: 'Dino Walls',
description: DinoWallsGame.description,
gameBuilder: (_) => DinoWallsGame(),
)
..addGame(
title: 'Slingshots',
description: SlingshotsGame.description,
gameBuilder: (_) => SlingshotsGame(),
);
}

@ -1,11 +0,0 @@
import 'package:dashbook/dashbook.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/dino_wall/dino_wall_game.dart';
void addDinoWallStories(Dashbook dashbook) {
dashbook.storiesOf('DinoWall').addGame(
title: 'Traced',
description: DinoWallGame.description,
gameBuilder: (_) => DinoWallGame(),
);
}

@ -1,11 +0,0 @@
import 'package:dashbook/dashbook.dart';
import 'package:sandbox/common/common.dart';
import 'package:sandbox/stories/slingshot/slingshot_game.dart';
void addSlingshotStories(Dashbook dashbook) {
dashbook.storiesOf('Slingshots').addGame(
title: 'Traced',
description: SlingshotGame.description,
gameBuilder: (_) => SlingshotGame(),
);
}

@ -3,8 +3,7 @@ export 'backboard/stories.dart';
export 'ball/stories.dart';
export 'bottom_group/stories.dart';
export 'boundaries/stories.dart';
export 'chrome_dino/stories.dart';
export 'dino_wall/stories.dart';
export 'dino_desert/stories.dart';
export 'effects/stories.dart';
export 'flutter_forest/stories.dart';
export 'google_word/stories.dart';
@ -14,5 +13,4 @@ export 'multiball/stories.dart';
export 'multipliers/stories.dart';
export 'plunger/stories.dart';
export 'score/stories.dart';
export 'slingshot/stories.dart';
export 'sparky_scorch/stories.dart';

@ -12,6 +12,7 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();
final assets = [
Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName,
];
final flameTester = FlameTester(() => TestGame(assets));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 148 KiB

@ -14,6 +14,7 @@ void main() {
Assets.images.dino.animatronic.head.keyName,
Assets.images.dino.animatronic.mouth.keyName,
Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName,
Assets.images.slingshot.upper.keyName,
Assets.images.slingshot.lower.keyName,

@ -48,6 +48,7 @@ void main() {
Assets.images.dino.animatronic.mouth.keyName,
Assets.images.dino.animatronic.head.keyName,
Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName,
Assets.images.dash.animatronic.keyName,
Assets.images.dash.bumper.a.active.keyName,

Loading…
Cancel
Save