C# - 如何让用户输入一个角色,而无需按Enter键

时间:2014-12-23 11:29:24

标签: c#

我不知道如何做到这一点,我已经尝试过我在互联网上看到的一切,但它并没有起作用。我所能得到的只是使用Console.WriteLine中的压缩字母,但我不能在#34;中使用它,如果"功能。你能救我吗?

编辑: 这个" mov"表示移动,我需要用户按下其中一个字符,然后程序将执行其操作

...
        Console.Write("ur movement? (w,a,s,d)");
        //somehow make him input one of these without needing to press Enter
        if (mov == 'w')
        {
            arr[x, y] = 0;
            x--;
        }
        if (mov == 'a')
        {
            arr[x, y] = 0;
            y--;
        }
        if (mov == 's')
        {
            arr[x, y] = 0;
            x++;
        }
        if (mov == 'd')
        {
            arr[x, y] = 0;
            y++;
        }

0 个答案:

没有答案
相关问题