Skip to content

Commit

Permalink
fix: Fix positioning and size of the scoreboard panel
Browse files Browse the repository at this point in the history
  • Loading branch information
luanpotter committed Jul 15, 2024
1 parent 52e213e commit 1da80c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/game/components/score_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ScoreBox extends PositionComponent
void onLoad() {
final availableHeight = game.size.y - 2 * screenMargin;
size = Vector2(scoreBoxWidth, availableHeight / maxShips - scoreBoxMargin);
rRect = RRect.fromRectAndRadius(Vector2.zero() & size, _radius);
rRect = RRect.fromRectAndRadius(Vector2(scoreBoxMargin, 0) & size, _radius);
}

@override
Expand Down
5 changes: 3 additions & 2 deletions lib/game/components/score_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class ScorePanel extends RectangleComponent
with HasGameReference<LightRunnersGame> {
@override
void onLoad() {
position = Vector2(fixedSize.x - scoreBoxWidth, 0) - fixedSize / 2;
size = Vector2(scoreBoxWidth, fixedSize.y);
final left = fixedSize.x - scoreBoxWidth - 2 * scoreBoxMargin;
position = Vector2(left, screenMargin) - fixedSize / 2;
size = Vector2(scoreBoxWidth, fixedSize.y - screenMargin * 2);
paint = Paint()..color = GamePalette.black;
addAll(
game.ships.values.map(
Expand Down

0 comments on commit 1da80c5

Please sign in to comment.