Format
Plain text
Post date
2019-02-08 19:10
Zeitraum der Veröffentlichung
Unbegrenzt
  1. using System;
  2. namespace mozgatas
  3. {
  4. class MainClass
  5. {
  6. public static void Main(string[] args)
  7. {
  8. int x = 39;
  9. int y = 10;
  10. alaphelyzet(x,y);
  11. while (true)
  12. {
  13. var b = Console.ReadKey(true);
  14. if (b.Key == ConsoleKey.Escape) break;
  15. if (b.Key == ConsoleKey.RightArrow) x++;
  16. if (b.Key == ConsoleKey.LeftArrow) x--;
  17. if (b.Key == ConsoleKey.UpArrow) y--;
  18. if (b.Key == ConsoleKey.DownArrow) y++;
  19. if (y < 0) y = 0;
  20. if (x < 0) x = 0;
  21. if (y > 22) y = 22;
  22. if (x > 77) x = 77;
  23. alaphelyzet(x, y);
  24. }
  25. }
  26. private static void alaphelyzet(int x, int y)
  27. {
  28. Console.Title = "Retro GAME";
  29. Console.SetWindowSize(80, 24);
  30. Console.SetBufferSize(80, 24);
  31. Console.CursorVisible = false;
  32. Console.Clear();
  33. Console.SetCursorPosition(x, y);
  34. Console.Write('█');
  35. Console.SetCursorPosition(x+1, y);
  36. Console.Write('█');
  37. Console.SetCursorPosition(x, y+1);
  38. Console.Write('█');
  39. Console.SetCursorPosition(x+1, y+1);
  40. Console.Write('█');
  41. }
  42. }
  43. }
Download Printable view

URL of this paste

Embed with JavaScript

Embed with iframe

Raw text