Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Input() // handle controls
- {
- if(_kbhit()) // boolean positive if key is pressed
- {
- switch(_getch()) // gets ascii val of key pressed
- {
- case 'a':
- dir = LEFT;
- break;
- case 'd':
- dir = RIGHT;
- break;
- case 'w':
- dir = UP;
- break;
- case 's':
- dir = DOWN;
- break;
- case 'x':
- gameOver = true;
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement