Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace x
- {
- class Program
- {
- static void Main(string[] args)
- {
- int x = 1;
- int y = 1;
- int w;
- int h;
- do
- {
- w = Console.WindowWidth;
- h = Console.WindowHeight;
- Console.CursorVisible = false;
- if (Console.ReadKey().Key == ConsoleKey.RightArrow)
- {
- Console.Clear();
- x = x + 1;
- if (x == w) x = 1; //dziala
- Console.SetCursorPosition(x, y);
- Console.Write("x");
- }
- if (Console.ReadKey().Key == ConsoleKey.LeftArrow)
- {
- Console.Clear();
- x = x - 1;
- if (x <= 0) x = x + w - 1;
- Console.SetCursorPosition(x, y);
- Console.Write("x");
- }
- if (Console.ReadKey().Key == ConsoleKey.UpArrow)
- {
- Console.Clear();
- y = y - 1;
- if (y <= 0) y = y + h - 1;
- Console.SetCursorPosition(x, y);
- Console.Write("x");
- }
- if (Console.ReadKey().Key == ConsoleKey.DownArrow)
- {
- Console.Clear();
- y = y + 1;
- if (y == h) y = 1; //dziala
- Console.SetCursorPosition(x, y);
- Console.Write("x");
- }
- } while (Console.ReadKey().Key != ConsoleKey.Escape);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment