Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace NewNamespace
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. ConsoleKeyInfo key;
  11. int x = 0, y = 0;
  12. do
  13. {
  14. Console.Clear();
  15. Console.SetCursorPosition(x, y);
  16. Console.WriteLine("@");
  17. key = Console.ReadKey();
  18. if (key.Key == ConsoleKey.LeftArrow) x--;
  19. if (key.Key == ConsoleKey.RightArrow)x++;
  20. if (key.Key == ConsoleKey.UpArrow) y--;
  21. if (key.Key == ConsoleKey.DownArrow) y++;
  22.  
  23. if (x < 0) x = 0;
  24. if (y < 0) y = 0;
  25. }
  26. while (key.Key != ConsoleKey.Escape);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement