Skip to content

Instantly share code, notes, and snippets.

@Devhobby
Created December 6, 2018 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Devhobby/68008829cf3c9add0dae9dbed9494e90 to your computer and use it in GitHub Desktop.
Save Devhobby/68008829cf3c9add0dae9dbed9494e90 to your computer and use it in GitHub Desktop.
wsad
do
{
tst = 0;
char keyboardChar = _getch();
actualMove = (keyboardChar == 'w' || keyboardChar == 'W') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(0) ? 0
: (keyboardChar == 'd' || keyboardChar == 'D') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(1) ? 1
: (keyboardChar == 's' || keyboardChar == 'S') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(2) ? 2
: (keyboardChar == 'a' || keyboardChar == 'A') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(3) ? 3
: (keyboardChar == 'q' || keyboardChar == 'Q') && (p_player->get_actX() == p_player->get_endX() && p_player->get_actY() == p_player->get_endY()) ? 4
: keyboardChar == 'e' || keyboardChar == 'E' ? 5
: keyboardChar == 'r' || keyboardChar == 'R' ? 6
: tst = 1;
} while (tst == 1);
return actualMove;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment