Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static public void dMain()
- {
- int x = 5;
- int y = 5;
- int xa; ;
- int ya; ;
- xa = x;
- ya = y;
- Press(ref x, ref y);
- }
- static void Press(ref int x1, ref int y1)
- {
- ConsoleKeyInfo info = Console.ReadKey();
- string b = info.Key.ToString();
- switch (b)
- {
- case ("W"):
- y1 = y1 - 1;
- if (y1 == 0)
- {
- y1 = 10;
- }
- break;
- case ("S"):
- y1 = y1 + 1;
- if (y1 >= 11)
- {
- y1 = 1;
- }
- break;
- case ("D"):
- x1 = x1 + 1;
- if (x1 >= 11)
- {
- x1 = 1;
- }
- break;
- case ("A"):
- x1 = x1 - 1;
- if (x1 <= 0)
- {
- x1 = 10;
- }
- break;
- default:
- break;
- }
- }
- //
- static void Change(ref char[,] map_change, int x1, int y1, int x2, int y2)
- {
- char helper;
- helper = map_change[y1 - 1, x1 - 1];
- map_change[y1 - 1, x1 - 1] = map_change[y2 - 1, x2 - 1];
- map_change[y2 - 1, x2 - 1] = helper;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement