Skip to content

Commit 72c0406

Browse files
committed
Merge pull request #370 from fdelapena/master
Fix wrong camera offset. Fixes #361
2 parents 6b83ccc + 782c258 commit 72c0406

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/game_player.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ bool Game_Player::IsTeleporting() const {
231231
void Game_Player::Center(int x, int y) {
232232
int center_x = (DisplayUi->GetWidth() / (TILE_SIZE / 16) - TILE_SIZE * 2) * 8 - Game_Map::GetPanX();
233233
int center_y = (DisplayUi->GetHeight() / (TILE_SIZE / 16) - TILE_SIZE) * 8 - Game_Map::GetPanY();
234-
int max_x = (Game_Map::GetWidth() - DisplayUi->GetWidth() / TILE_SIZE) * (SCREEN_TILE_WIDTH);
235-
int max_y = (Game_Map::GetHeight() - DisplayUi->GetHeight() / TILE_SIZE) * (SCREEN_TILE_WIDTH);
234+
int max_x = (Game_Map::GetWidth() - DisplayUi->GetWidth() / TILE_SIZE) * SCREEN_TILE_WIDTH;
235+
int max_y = (Game_Map::GetHeight() - DisplayUi->GetHeight() / TILE_SIZE) * SCREEN_TILE_WIDTH;
236236
Game_Map::SetDisplayX(max(0, min((x * SCREEN_TILE_WIDTH - center_x), max_x)));
237-
Game_Map::SetDisplayY(max(0, min((y * SCREEN_TILE_WIDTH - center_y), max_y)));
237+
Game_Map::SetDisplayY(max(0, min((y * SCREEN_TILE_WIDTH - center_y), max_y)));
238238
}
239239

240240
void Game_Player::MoveTo(int x, int y) {

0 commit comments

Comments
 (0)