Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Menu
- {
- static void Main(string[] args)
- {
- Console.CursorVisible = false;
- char[,] map =
- {
- {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#' },
- {'#',' ',' ',' ',' ','|',' ',' ',' ',' ',' ','|',' ',' ',' ',' ',' ',' ','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ','#' },
- {'#',' ',' ','|',' ','|','=','|',' ','|','=','|',' ','|','=','=','|',' ','|',' ','|','=','=','=','|',' ','|','=','=','|','*','#' },
- {'#',' ',' ','|',' ',' ',' ','|',' ',' ',' ',' ',' ','|','*',' ',' ',' ','|',' ','|',' ',' ',' ','|',' ',' ',' ',' ',' ',' ','#' },
- {'#',' ',' ','|',' ','|','=','|',' ','|','=','|',' ','|','=','=','|',' ','|',' ','|',' ','|','=','|',' ','|','=','=','|','X','#' },
- {'#','=','=','|',' ',' ',' ','|',' ','|','X','|',' ',' ',' ',' ','|',' ','|','*','|',' ',' ',' ',' ',' ',' ',' ',' ','|','=','#' },
- {'#',' ',' ',' ',' ','|',' ','|',' ','|',' ','|','=','=','|',' ','|',' ','|',' ','|',' ','|','=','=','=','=','=','=','|',' ','#' },
- {'#','*','|','=','=','|',' ','|',' ',' ',' ',' ',' ',' ','|',' ','|',' ','|','=','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#' },
- {'#','=','|',' ',' ',' ',' ','|','=','=','=','=','|',' ','|','=','|',' ',' ',' ',' ',' ','|','=','=','=','=','=','=','|',' ','#' },
- {'#','X',' ',' ','|',' ',' ',' ',' ',' ',' ',' ','|',' ','|','*',' ',' ','|','=','|',' ',' ',' ',' ',' ',' ',' ',' ','|',' ','#' },
- {'#','=','=','=','|','=','=','=','=','=','|',' ','|',' ','|','=','=','=','|',' ','|',' ','|','=','=','|',' ','|','=','|',' ','#' },
- {'#',' ','*',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|',' ',' ',' ',' ',' ','|',' ','|',' ',' ','|','X','|','*',' ',' ','#' },
- {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#' }
- };
- char[] bag = new char[0];
- char[] dead = new char[0];
- int userX = 4, userY = 2;
- while (true)
- {
- Console.SetCursorPosition(0, 0);
- for (int i = 0; i < map.GetLength(0); i++)
- {
- for (int j = 0; j < map.GetLength(1); j++)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.Write(map[i, j]);
- }
- Console.WriteLine();
- }
- Console.ForegroundColor = ConsoleColor.Red;
- Console.SetCursorPosition(0, 15);
- Console.Write("Сокровища: ");
- for (int i = 0; i < bag.Length; i++)
- {
- Console.Write(bag[i] + " ");
- }
- Console.SetCursorPosition(0, 17);
- Console.Write("Смерти: ");
- for (int i = 0; i < dead.Length; i++)
- {
- Console.Write(dead[i] + " ");
- }
- Console.SetCursorPosition(userY, userX);
- Console.Write('O');
- ConsoleKeyInfo charKey = Console.ReadKey();
- switch (charKey.Key)
- {
- case ConsoleKey.UpArrow:
- if (map[userX - 1, userY] != '#' && map[userX - 1, userY] != '=' && map[userX - 1, userY] != '|')
- userX--;
- break;
- case ConsoleKey.DownArrow:
- if (map[userX + 1, userY] != '#' && map[userX + 1, userY] != '=' && map[userX + 1, userY] != '|')
- userX++;
- break;
- case ConsoleKey.LeftArrow:
- if (map[userX, userY - 1] != '#' && map[userX, userY - 1] != '=' && map[userX, userY - 1] != '|')
- userY--;
- break;
- case ConsoleKey.RightArrow:
- if (map[userX, userY + 1] != '#' && map[userX, userY + 1] != '=' && map[userX, userY + 1] != '|')
- userY++;
- break;
- }
- if (map[userX, userY] == '*')
- {
- map[userX, userY] = ' ';
- char[] tempBag = new char[bag.Length + 1];
- for (int i = 0; i < bag.Length; i++)
- {
- tempBag[i] = bag[i];
- }
- tempBag[tempBag.Length - 1] = '*';
- bag = tempBag;
- if(tempBag.Length >= 7)
- {
- Console.Clear();
- Console.SetCursorPosition(0, 0);
- Console.WriteLine("Вы собрали все сокровища!");
- Console.ReadKey();
- break;
- }
- }
- if (map[userX, userY] == 'X')
- {
- map[userX, userY] = ' ';
- char[] tempDead = new char[dead.Length + 1];
- for (int i = 0; i < dead.Length; i++)
- {
- tempDead[i] = dead[i];
- }
- tempDead[tempDead.Length - 1] = 'X';
- dead = tempDead;
- if (tempDead.Length >= 3)
- {
- Console.Clear();
- Console.SetCursorPosition(0, 0);
- Console.WriteLine("Вы потратили все жизни!");
- Console.ReadKey();
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment