Skip to content

Commit

Permalink
Merge pull request #2665 from fmatthew5876/scrollfix
Browse files Browse the repository at this point in the history
Add RPG_RT player direction scrolling logic
  • Loading branch information
Ghabry authored Oct 28, 2021
2 parents 7eb6145 + 029ff26 commit 2c07263
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,23 @@ void Game_Player::UpdateScroll(int amount, bool was_jumping) {
return;
}

Game_Map::Scroll(sx * amount, sy * amount);
int move_sx = 0;
int move_sy = 0;
const auto d = GetDirection();
if (sy < 0 && (d == Up || d == UpRight || d == UpLeft)) {
move_sy = sy;
}
if (sy > 0 && (d == Down || d == DownRight || d == DownLeft)) {
move_sy = sy;
}
if (sx > 0 && (d == Right || d == UpRight || d == DownRight)) {
move_sx = sx;
}
if (sx < 0 && (d == Left || d == UpLeft || d == DownLeft)) {
move_sx = sx;
}

Game_Map::Scroll(move_sx * amount, move_sy * amount);
}

bool Game_Player::UpdateAirship() {
Expand Down

0 comments on commit 2c07263

Please sign in to comment.