0

How to get specific key input from user?

I was wondering how to get specific key input("enter" for example), so the user can only press that key to use a specific function.

6th Jun 2017, 2:36 AM
Unknown Unknown
Unknown Unknown - avatar
2 Réponses
+ 4
Something like this? char input = (char)Console.Read(); or maybe: char input = Console.ReadKey().KeyChar; Then: if(input == 'w') moveUp(); else if(input == 'd') moveRight();
6th Jun 2017, 2:56 AM
Rrestoring faith
Rrestoring faith - avatar
0
Ok I'll try that thanks.
6th Jun 2017, 3:06 AM
Unknown Unknown
Unknown Unknown - avatar