From 37aeea92755564f3507cba7f4b79e2556e1ff772 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 12 Mar 2022 14:54:01 -0500 Subject: fixed some input annoyances --- src/main.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') 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) game.playerAnim.setAnimation("walk"); game.playerAnim.setDirection(dir); - return movePlayer(game, px, py); + bool succeeds = movePlayer(game, px, py); + if (!succeeds && px != game.player_x) { + succeeds = movePlayer(game, px, game.player_y); + } + if (!succeeds && py != game.player_y) { + succeeds = movePlayer(game, game.player_x, py); + } + return succeeds; } else { return false; } @@ -748,9 +755,7 @@ int main(int, char**) if (game.queueDash && !game.moving) { game.queueDash = false; - if (state[SDL_SCANCODE_SPACE]) { - performDash(game, rng); - } + performDash(game, rng); } if (keystate.left || keystate.right || keystate.up || keystate.down) -- cgit 1.4.1