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

Commit

Permalink
Merge branch 'main' into feat/leaderboard
Browse files Browse the repository at this point in the history
  • Loading branch information
marcossevilla authored Oct 30, 2023
2 parents 772aec2 + b02b424 commit 597365c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/game/components/player_camera_anchor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PlayerCameraAnchor extends Component
final Vector2 _anchor = Vector2.zero();

late final Vector2 _cameraMin = Vector2(
cameraViewport.x / 2,
cameraViewport.x * .4,
cameraViewport.y / 2,
);

Expand All @@ -23,12 +23,14 @@ class PlayerCameraAnchor extends Component
levelSize.y - cameraViewport.y / 2,
);

late final _cameraXOffset = cameraViewport.x * .4;

@override
Vector2 get position => _anchor;

void _setAnchor(double x, double y) {
_anchor
..x = x.clamp(_cameraMin.x, _cameraMax.x)
..x = x.clamp(_cameraMin.x, _cameraMax.x) + _cameraXOffset
..y = y.clamp(_cameraMin.y, _cameraMax.y);
}

Expand Down

0 comments on commit 597365c

Please sign in to comment.