summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-03-12 14:54:01 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2022-03-12 14:54:01 -0500
commit37aeea92755564f3507cba7f4b79e2556e1ff772 (patch)
treea7df73676e9f235180dff11c82394374bc3ecbcb
parent627de7dc54b39d69dab3504a1e71e3893bb9cf02 (diff)
downloadether-37aeea92755564f3507cba7f4b79e2556e1ff772.tar.gz
ether-37aeea92755564f3507cba7f4b79e2556e1ff772.tar.bz2
ether-37aeea92755564f3507cba7f4b79e2556e1ff772.zip
fixed some input annoyances
-rw-r--r--src/main.cpp13
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)