Skip to content

Instantly share code, notes, and snippets.

@Devhobby
Last active April 8, 2018 21:31
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/d531e33616d0005c4390950f731c4d7b to your computer and use it in GitHub Desktop.
Save Devhobby/d531e33616d0005c4390950f731c4d7b to your computer and use it in GitHub Desktop.
If- else if wersja 1.
int actualMove;
do
{
tst = 0;
char keyboardChar = _getch(); //Pobieranie znaku z klawiatury
if ((keyboardChar == 'w' || keyboardChar == 'W') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(0)) actualMove = 0;
else if ((keyboardChar == 'd' || keyboardChar == 'D') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(1)) actualMove = 1;
else if ((keyboardChar == 's' || keyboardChar == 'S') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(2)) actualMove = 2;
else if ((keyboardChar == 'a' || keyboardChar == 'A') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(3)) actualMove = 3;
else if ((keyboardChar == 'q' || keyboardChar == 'Q') && (p_player->get_actX() == p_player->get_endX() && p_player->get_actY() == p_player->get_endY())) actualMove = 4;
else if (keyboardChar == 'e' || keyboardChar == 'E') actualMove = 5;
else if (keyboardChar == 'r' || keyboardChar == 'R') actualMove = 6;
else 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