5

I've been trying to make a small game in the Console Application within Visual Studio. I want detect when I let go of a key. Because now when i let go of the key it stays "true" until i hit any other key.

Here is my code,

while (true)
{
    keyInfo = Console.ReadKey();

    if(keyInfo.Key == ConsoleKey.RightArrow)
    {
         rightPressed = true;
    } else
    {
         rightPressed = false;
    }
}

Does someone have a solution?

leppie
  • 115,091
  • 17
  • 196
  • 297
  • Looks like there is no solution for key up event on console applications. You should go with Forms. Otherwise you should workaround your logic of key up events function. – Tolga Evcimen Apr 26 '16 at 08:25

0 Answers0