- using System;
- namespace mozgatas
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int x = 39;
- int y = 10;
- alaphelyzet(x,y);
- while (true)
- {
- var b = Console.ReadKey(true);
- if (b.Key == ConsoleKey.Escape) break;
- if (b.Key == ConsoleKey.RightArrow) x++;
- if (b.Key == ConsoleKey.LeftArrow) x--;
- if (b.Key == ConsoleKey.UpArrow) y--;
- if (b.Key == ConsoleKey.DownArrow) y++;
- if (y < 0) y = 0;
- if (x < 0) x = 0;
- if (y > 22) y = 22;
- if (x > 77) x = 77;
- alaphelyzet(x, y);
- }
- }
- private static void alaphelyzet(int x, int y)
- {
- Console.Title = "Retro GAME";
- Console.SetWindowSize(80, 24);
- Console.SetBufferSize(80, 24);
- Console.CursorVisible = false;
- Console.Clear();
- Console.SetCursorPosition(x, y);
- Console.Write('█');
- Console.SetCursorPosition(x+1, y);
- Console.Write('█');
- Console.SetCursorPosition(x, y+1);
- Console.Write('█');
- Console.SetCursorPosition(x+1, y+1);
- Console.Write('█');
- }
- }
- }