Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
feat: adjust scale of plastic bottles (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
alestiago authored Mar 10, 2024
1 parent 32d2fe8 commit 79c2666
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions packages/trashy_road/lib/src/game/entities/trash/trash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ class Trash extends PositionedEntity

/// The different styles of plastic bottles.
enum PlasticStyle {
/// {@template _PlasticStyle.one}
/// {@template _PlasticStyle.plasticBottleOne}
/// A crushed plastic bottle that is laying on the ground with its lid facing
/// east.
/// {@endtemplate}
one,
plasticBottleOne,

/// {@template _PlasticStyle.two}
/// {@template _PlasticStyle.plasticBottleTwo}
/// A crushed plastic bottle that is laying on the ground with its lid facing
/// south-east.
/// {@endtemplate}
two,
plasticBottleTwo,

/// {@template _PlasticStyle.coldTakeAwayCup}
/// A takeaway cup with a straw.
Expand Down Expand Up @@ -241,11 +241,11 @@ class _PlasticSpriteGroup extends PositionComponent
_PlasticSpriteGroup._({
required String spritePath,
required String shadowPath,
super.scale,
}) : super(
// The `position` and `scale` have been eyeballed to match with the
// appearance of the map.
position: Vector2(0.5, 1.4)..toGameSize(),
scale: Vector2.all(0.8),
anchor: Anchor.center,
children: [
GameSpriteComponent.fromPath(
Expand All @@ -264,10 +264,10 @@ class _PlasticSpriteGroup extends PositionComponent
PlasticStyle style,
) {
switch (style) {
case PlasticStyle.one:
return _PlasticSpriteGroup._styleOne();
case PlasticStyle.two:
return _PlasticSpriteGroup._styleTwo();
case PlasticStyle.plasticBottleOne:
return _PlasticSpriteGroup._plasticBottleOne();
case PlasticStyle.plasticBottleTwo:
return _PlasticSpriteGroup._plasticBottleTwo();
case PlasticStyle.coldTakeAwayCup:
return _PlasticSpriteGroup._coldTakeAwayCup();
case PlasticStyle.straw:
Expand All @@ -277,34 +277,39 @@ class _PlasticSpriteGroup extends PositionComponent
}
}

/// {@macro _PlasticStyle.one}
factory _PlasticSpriteGroup._styleOne() => _PlasticSpriteGroup._(
/// {@macro _PlasticStyle.plasticBottleOne}
factory _PlasticSpriteGroup._plasticBottleOne() => _PlasticSpriteGroup._(
spritePath: Assets.images.sprites.plasticBottle1.path,
shadowPath: Assets.images.sprites.plasticBottle1Shadow.path,
scale: Vector2.all(0.5),
);

/// {@macro _PlasticBo_PlasticStylettleStyle.two}
factory _PlasticSpriteGroup._styleTwo() => _PlasticSpriteGroup._(
/// {@macro _PlasticBo_PlasticStylettleStyle.plasticBottleTwo}
factory _PlasticSpriteGroup._plasticBottleTwo() => _PlasticSpriteGroup._(
spritePath: Assets.images.sprites.plasticBottle2.path,
shadowPath: Assets.images.sprites.plasticBottle2Shadow.path,
scale: Vector2.all(0.5),
);

/// {@macro _PlasticStyle.coldTakeAwayCup}
factory _PlasticSpriteGroup._coldTakeAwayCup() => _PlasticSpriteGroup._(
spritePath: Assets.images.sprites.takeawayCupCold.path,
shadowPath: Assets.images.sprites.takeawayCupColdShadow.path,
scale: Vector2.all(0.8),
);

/// {@macro _PlasticStyle.straw}
factory _PlasticSpriteGroup._straw() => _PlasticSpriteGroup._(
spritePath: Assets.images.sprites.plasticStraw.path,
shadowPath: Assets.images.sprites.plasticStrawShadow.path,
scale: Vector2.all(0.8),
);

/// {@macro _PlasticStyle.canHolder}
factory _PlasticSpriteGroup._canHolder() => _PlasticSpriteGroup._(
spritePath: Assets.images.sprites.canHolder.path,
shadowPath: Assets.images.sprites.canHolderShadow.path,
scale: Vector2.all(0.8),
);
}

Expand Down

0 comments on commit 79c2666

Please sign in to comment.