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

Commit

Permalink
feat: adjustment in the camera (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo authored Oct 31, 2023
1 parent c61a5dc commit 4d7653f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/game/components/player_camera_anchor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ class PlayerCameraAnchor extends Component
);

late final _cameraXOffset = cameraViewport.x * .4;
late final _cameraYOffset = cameraViewport.y * .2;

@override
Vector2 get position => _anchor;

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

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/game/dash_run_game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DashRunGame extends LeapGame
);

static const prefix = 'assets/map/';
static final _cameraViewport = Vector2(592, 1280);
static final _cameraViewport = Vector2(592, 1024);

final AssetBundle? customBundle;

Expand Down

0 comments on commit 4d7653f

Please sign in to comment.