Now player can't turn into itself
parent
21e1f14990
commit
8b9fcdd3df
|
@ -55,12 +55,16 @@ int main(int argc, char **argv)
|
||||||
case 'q':
|
case 'q':
|
||||||
*running = false; return 0;
|
*running = false; return 0;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
if (player->direction == DOWN) break;
|
||||||
player->direction = UP; break;
|
player->direction = UP; break;
|
||||||
case 'd':
|
case 'd':
|
||||||
|
if (player->direction == LEFT) break;
|
||||||
player->direction = RIGHT; break;
|
player->direction = RIGHT; break;
|
||||||
case 's':
|
case 's':
|
||||||
|
if (player->direction == UP) break;
|
||||||
player->direction = DOWN; break;
|
player->direction = DOWN; break;
|
||||||
case 'a':
|
case 'a':
|
||||||
|
if (player->direction == RIGHT) break;
|
||||||
player->direction = LEFT; break;
|
player->direction = LEFT; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue