diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 2f18995..27c78ec 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -358,7 +358,14 @@ bool processKeys(Game& game, const Input& keystate) | |||
358 | game.playerAnim.setAnimation("walk"); | 358 | game.playerAnim.setAnimation("walk"); |
359 | game.playerAnim.setDirection(dir); | 359 | game.playerAnim.setDirection(dir); |
360 | 360 | ||
361 | return movePlayer(game, px, py); | 361 | bool succeeds = movePlayer(game, px, py); |
362 | if (!succeeds && px != game.player_x) { | ||
363 | succeeds = movePlayer(game, px, game.player_y); | ||
364 | } | ||
365 | if (!succeeds && py != game.player_y) { | ||
366 | succeeds = movePlayer(game, game.player_x, py); | ||
367 | } | ||
368 | return succeeds; | ||
362 | } else { | 369 | } else { |
363 | return false; | 370 | return false; |
364 | } | 371 | } |
@@ -748,9 +755,7 @@ int main(int, char**) | |||
748 | 755 | ||
749 | if (game.queueDash && !game.moving) { | 756 | if (game.queueDash && !game.moving) { |
750 | game.queueDash = false; | 757 | game.queueDash = false; |
751 | if (state[SDL_SCANCODE_SPACE]) { | 758 | performDash(game, rng); |
752 | performDash(game, rng); | ||
753 | } | ||
754 | } | 759 | } |
755 | 760 | ||
756 | if (keystate.left || keystate.right || keystate.up || keystate.down) | 761 | if (keystate.left || keystate.right || keystate.up || keystate.down) |