kisame1313

Untitled

Jul 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 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.                 case ConsoleKey.UpArrow:        
  14.                     y--;
  15.                     break;
  16.  
  17.                 case ConsoleKey.DownArrow:
  18.                     y++;
  19.                     break;
  20.  
  21.                 case ConsoleKey.LeftArrow:
  22.                     x--;
  23.                     break;
  24.  
  25.                 case ConsoleKey.RightArrow:
  26.                     x++;
  27.                     break;
  28.                 }
  29.  
  30.                 Console.Clear();
  31.                 Console.SetCursorPosition(x,y);
  32.                 Console.Write(x%2==0 ? '#' : '$');
  33.             }
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment