kisame1313

Untitled

Jul 12th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4.     {
  5.     static void Main(string[] args)
  6.         {
  7.         int x = 0, y = 0;
  8.         while(true)
  9.             {
  10.             ConsoleKeyInfo InputKey = Console.ReadKey();
  11.             switch(InputKey.Key)
  12.                 {
  13.                 //Верхняя стрелочка
  14.                 case ConsoleKey.UpArrow:
  15.                     y--;
  16.                     break;
  17.                 //end
  18.  
  19.                 //Нижняя стрелочка
  20.                 case ConsoleKey.DownArrow:
  21.                     y++;
  22.                     break;
  23.                 //end
  24.  
  25.                 //Левая стрелочка
  26.                 case ConsoleKey.LeftArrow:
  27.                     x--;
  28.                     break;
  29.                 //end
  30.  
  31.                 //Правая стрелочка
  32.                 case ConsoleKey.RightArrow:
  33.                     x++;
  34.                     break;
  35.                     //end
  36.                 }
  37.  
  38.             Console.Clear();
  39.             Console.SetCursorPosition(x,y);
  40.             Console.Write('#');
  41.             }
  42.         }
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment