コード例 #1
0
        public static void Menu()
        {
            while (choise != 4 && keepPlaing == true)
            {
                if (MyPlayer.Hp == 0)
                {
                    Levels.PrintInTheMiddle("Let's try again " + MyPlayer.Name);
                    SpecMonster.AddMonster();
                    ResetPlayer();
                    ResetMonsters();
                    ShowDetails();
                    Console.WriteLine();
                }
                ShowMeny();

                FourActions();
                if (Levels.ans == "y")
                {
                    keepPlaing = true;
                }
            }
        }
コード例 #2
0
        public static string Welcome()
        {
            Levels.PrintInTheMiddle("************************");
            Levels.PrintInTheMiddle("* Welcome to The Game! *");
            Levels.PrintInTheMiddle("************************");
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            Levels.PrintInTheMiddle("(q) = Quit");
            Console.SetCursorPosition((Console.WindowWidth - "************************".Length) / 2, Console.CursorTop);
            Console.Write("Enter your name: ");
            playerName = Console.ReadLine();
            switch (playerName)
            {
            case "Robin":
                Levels.PrintInTheMiddle("");
                Levels.PrintInTheMiddle("****************************************************");
                Levels.PrintInTheMiddle("*GODMODE ACTIVATED: + 500 gold coins               *");
                Levels.PrintInTheMiddle("*                   + Super Power (100 strength)   *");
                Levels.PrintInTheMiddle("*                   + Golden Shield (100 toughness)*");
                Levels.PrintInTheMiddle("****************************************************");
                MyPlayer.Gold      += 500;
                MyPlayer.Strength  += 100;
                MyPlayer.Toughness += 100;
                Levels.MoveToNext();
                break;

            case "q":
                keepPlaing = false;
                choise     = 4;
                break;

            default:
                break;
            }
            Console.Clear();
            return(playerName);
        }
コード例 #3
0
ファイル: Shoping.cs プロジェクト: Rauf84/Labb3VG
        public static void Shoping1()
        {
            Console.WriteLine();
            Levels.PrintInTheMiddle("Welcome to the shop");
            bool keepShopping = true;

            while (keepShopping)
            {
                Console.WriteLine();
                Levels.PrintInTheMiddle($"You have {Program.MyPlayer.Gold} coins");
                Levels.PrintInTheMiddle("Enter q to go back to the game");
                Console.WriteLine();
                Levels.PrintInTheMiddle("=================================");
                Levels.PrintInTheMiddle("|   Product        |  Price     |");
                Levels.PrintInTheMiddle("=================================");
                Levels.PrintInTheMiddle("| 1. + 100% hp     |  10 coins  |");
                Levels.PrintInTheMiddle("| 2. + 10 strength |  10 coins  |");
                Levels.PrintInTheMiddle("| 3. + 10 toughness|  10 coins  |");
                Levels.PrintInTheMiddle("=================================");
                Console.SetCursorPosition((Console.WindowWidth - "Enter you choise here: ".Length) / 2, Console.CursorTop);
                Console.Write("Enter your choise here: ");
                string shopChoise = Console.ReadLine();
                switch (shopChoise)
                {
                case "1":
                    if (Program.MyPlayer.Gold >= 10)
                    {
                        Program.MyPlayer.Hp   += 100;
                        Program.MyPlayer.Gold -= 10;
                    }
                    else
                    {
                        Levels.PrintInTheMiddle("* You have no enough coins !!! *");
                    }
                    break;

                case "2":
                    if (Program.MyPlayer.Gold >= 10)
                    {
                        Program.MyPlayer.Strength += 10;
                        Program.MyPlayer.Gold     -= 10;
                    }
                    else
                    {
                        Levels.PrintInTheMiddle("* You have no enough coins !!! *");
                    }
                    break;

                case "3":
                    if (Program.MyPlayer.Gold >= 10)
                    {
                        Program.MyPlayer.Toughness += 10;
                        Program.MyPlayer.Gold      -= 10;
                    }
                    else
                    {
                        Levels.PrintInTheMiddle("* You have no enough coins !!! *");
                    }
                    break;

                case "q":
                    Console.Clear();
                    keepShopping = false;
                    break;

                default:
                    Levels.PrintInTheMiddle("Wrong choise, please try again");
                    break;
                }
            } // loopar så länge man vill handla, avbryter loopen med 'q'
        }