Ejemplo n.º 1
0
 public static playerClass newPlayer()
 {
     playerClass character = new playerClass();
     return character;
 }
Ejemplo n.º 2
0
        //main game
        public static void Play(playerClass p, board[] b, int f)
        {
            floor = f;
            clearScreen();;
            character = p;
            gameMaps = b;
            ConsoleKeyInfo cki;
            do
            {
                if (f > gameMaps.Length - 1)
                {
                    WIN();
                    return;
                }
                board presentMap = gameMaps[f];
                Console.SetCursorPosition(0, 0);
                presentMap.printBoard();
                int[] player = presentMap.playerLocation();
                int x = player[0];
                int y = player[1];

                if (presentMap.town)
                {

                    Console.WriteLine("Where would you like to go?");
                    Console.Write("(G)eneral Store, (A)rmory, (O)ut of Town:");
                    cki = Console.ReadKey();
                    if (cki.Key == ConsoleKey.G)
                    {
                        generalStore genStore = Program.generateGeneralStore(f);
                        genStore.enterShop();
                        clearScreen();
                    }
                    else if (cki.Key == ConsoleKey.A)
                    {
                        itemShop ItemShop = Program.generateItemStore(f);
                        ItemShop.enterShop();
                        clearScreen();
                    }
                    else if (cki.Key == ConsoleKey.O)
                    {
                        f++;
                        clearScreen();
                    }
                }
                else
                {
                    cki = Console.ReadKey();
                    if (cki.Key == ConsoleKey.UpArrow)
                        presentMap.moveUP(x, y);
                    else if (cki.Key == ConsoleKey.DownArrow)
                        presentMap.moveDOWN(x, y);
                    else if (cki.Key == ConsoleKey.LeftArrow)
                        presentMap.moveLEFT(x, y);
                    else if (cki.Key == ConsoleKey.RightArrow)
                        presentMap.moveRIGHT(x, y);
                    if (presentMap.checkStairs(x, y))
                    {
                        f++;
                        clearScreen();
                    }
                    if (cki.Key == ConsoleKey.Enter)
                    {
                        f++;
                        clearScreen();
                    }
                }
            } while (cki.Key != ConsoleKey.Escape);
            Program.Save(character, gameMaps, f);
            endGame();
        }
Ejemplo n.º 3
0
 //creates gameSave
 public gameSave(playerClass p, board[] b, int f)
 {
     player = p;
     gameBoard = b;
     floor = f;
 }