feat: add hole in dino wall (#306)

* feat: add mouse hole in dino wall

* style: trailing comma
pull/310/head
Allison Ryan 3 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)); .add(const BonusActivated(GameBonus.dashNest));
canvas.add( canvas.add(
ControlledBall.bonus(characterTheme: gameRef.characterTheme) ControlledBall.bonus(characterTheme: gameRef.characterTheme)
..initialPosition = Vector2(17.2, -52.7), ..initialPosition = Vector2(29.5, -24.5),
); );
animatronic.playing = true; animatronic.playing = true;
signpost.bloc.onProgressed(); 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.bottomWall.keyName),
images.load(components.Assets.images.dino.topWall.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.head.keyName),
images.load(components.Assets.images.dino.animatronic.mouth.keyName), images.load(components.Assets.images.dino.animatronic.mouth.keyName),
images.load(components.Assets.images.dash.animatronic.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 => AssetGenImage get bottomWall =>
const AssetGenImage('assets/images/dino/bottom-wall.png'); 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 /// File path: assets/images/dino/top-wall.png
AssetGenImage get topWall => AssetGenImage get topWall =>
const AssetGenImage('assets/images/dino/top-wall.png'); const AssetGenImage('assets/images/dino/top-wall.png');

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

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

@ -14,19 +14,17 @@ void main() {
addBallStories(dashbook); addBallStories(dashbook);
addLayerStories(dashbook); addLayerStories(dashbook);
addEffectsStories(dashbook); addEffectsStories(dashbook);
addChromeDinoStories(dashbook);
addFlutterForestStories(dashbook); addFlutterForestStories(dashbook);
addBottomGroupStories(dashbook);
addPlungerStories(dashbook);
addSlingshotStories(dashbook);
addSparkyScorchStories(dashbook); addSparkyScorchStories(dashbook);
addAndroidAcresStories(dashbook); addAndroidAcresStories(dashbook);
addDinoDesertStories(dashbook);
addBottomGroupStories(dashbook);
addPlungerStories(dashbook);
addBoundariesStories(dashbook); addBoundariesStories(dashbook);
addGoogleWordStories(dashbook); addGoogleWordStories(dashbook);
addLaunchRampStories(dashbook); addLaunchRampStories(dashbook);
addScoreStories(dashbook); addScoreStories(dashbook);
addBackboardStories(dashbook); addBackboardStories(dashbook);
addDinoWallStories(dashbook);
addMultiballStories(dashbook); addMultiballStories(dashbook);
addMultipliersStories(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:pinball_components/pinball_components.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart'; import 'package:sandbox/stories/ball/basic_ball_game.dart';
class DinoWallGame extends BallGame { class DinoWallsGame extends BallGame {
DinoWallGame() : super(); DinoWallsGame() : super();
static const description = ''' static const description = '''
Shows how DinoWalls are rendered. Shows how DinoWalls are rendered.
@ -20,6 +20,7 @@ class DinoWallGame extends BallGame {
await images.loadAll([ await images.loadAll([
Assets.images.dino.topWall.keyName, Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName, Assets.images.dino.bottomWall.keyName,
]); ]);

@ -2,8 +2,8 @@ import 'package:flame/extensions.dart';
import 'package:pinball_components/pinball_components.dart'; import 'package:pinball_components/pinball_components.dart';
import 'package:sandbox/stories/ball/basic_ball_game.dart'; import 'package:sandbox/stories/ball/basic_ball_game.dart';
class SlingshotGame extends BallGame { class SlingshotsGame extends BallGame {
SlingshotGame() SlingshotsGame()
: super( : super(
imagesFileNames: [ imagesFileNames: [
Assets.images.slingshot.upper.keyName, 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 'ball/stories.dart';
export 'bottom_group/stories.dart'; export 'bottom_group/stories.dart';
export 'boundaries/stories.dart'; export 'boundaries/stories.dart';
export 'chrome_dino/stories.dart'; export 'dino_desert/stories.dart';
export 'dino_wall/stories.dart';
export 'effects/stories.dart'; export 'effects/stories.dart';
export 'flutter_forest/stories.dart'; export 'flutter_forest/stories.dart';
export 'google_word/stories.dart'; export 'google_word/stories.dart';
@ -14,5 +13,4 @@ export 'multiball/stories.dart';
export 'multipliers/stories.dart'; export 'multipliers/stories.dart';
export 'plunger/stories.dart'; export 'plunger/stories.dart';
export 'score/stories.dart'; export 'score/stories.dart';
export 'slingshot/stories.dart';
export 'sparky_scorch/stories.dart'; export 'sparky_scorch/stories.dart';

@ -12,6 +12,7 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
final assets = [ final assets = [
Assets.images.dino.topWall.keyName, Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName, Assets.images.dino.bottomWall.keyName,
]; ];
final flameTester = FlameTester(() => TestGame(assets)); 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.head.keyName,
Assets.images.dino.animatronic.mouth.keyName, Assets.images.dino.animatronic.mouth.keyName,
Assets.images.dino.topWall.keyName, Assets.images.dino.topWall.keyName,
Assets.images.dino.topWallTunnel.keyName,
Assets.images.dino.bottomWall.keyName, Assets.images.dino.bottomWall.keyName,
Assets.images.slingshot.upper.keyName, Assets.images.slingshot.upper.keyName,
Assets.images.slingshot.lower.keyName, Assets.images.slingshot.lower.keyName,

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

Loading…
Cancel
Save