Exemple #1
0
        /// <summary>
        /// The intro to the game
        /// </summary>
        public static void Intro()
        {
            bool   validInput = false;
            bool   skip       = false;
            string inp;

            //Checks to see if this is the first time the game is played
            if (firstTime)
            {
                //sets this variable such that the game knows its no longer the first time
                firstTime = false;

                //keeps asking until the player enters a valid input
                do
                {
                    //asks the user if they want to see the intro
                    Console.WriteLine("Would you like to see the intro (Y/N)");
                    inp = Console.ReadLine().ToLower();

                    //checks to see if the input was valid
                    if (inp == "y" || inp == "n")
                    {
                        //sets the boolean depending on what the user chose
                        if (inp == "y")
                        {
                            skip = false;
                        }
                        else
                        {
                            skip = true;
                        }

                        //allows the player to leave this section
                        validInput = true;
                    }
                    else
                    {
                        //lets the user know what they need to enter
                        Console.Clear();
                        Console.BackgroundColor = ConsoleColor.Red;
                        Console.WriteLine("Please enter either Y (for yes) or N (for no)");
                        Console.BackgroundColor = ConsoleColor.Black;
                    }
                } while (!validInput);
            }

            Console.Clear();

            //shows the intro if the player chose to see it
            if (!skip)
            {
                Console.WriteLine("In the year 3046, a great war broke out.");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("All technology was destroyed");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("The weak perished, and the strong fought to survive");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("Nuclear fallout resulted in the growth of monsters that roamed the world,");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("Humans had to work together to set up a safe base");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("The base was a success, and a positive future for humanity was forming");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("However, in the last 20 years, we have undergone many attacks,");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("And the walls that hold the beasts out are weakening, and soon they will fall");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("A hero is needed to save humanity.");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("Will you be the one");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("Will you be strong enough to to take on the beasts");
                Thread.Sleep(Numbers.longWait);
                Console.WriteLine("Train youself up");
                Thread.Sleep(Numbers.longWait);
                Console.Write("Go out there and fight");
                Thread.Sleep(Numbers.longWait);
            }
            else
            {
                Console.Write("Intro Skipped");
            }

            //lets the user read the intro
            Console.Write(".");
            Thread.Sleep(Numbers.shortWait);
            Console.Write(".");
            Thread.Sleep(Numbers.shortWait);
            Console.WriteLine(".");
            Thread.Sleep(Numbers.longWait);
            Console.BackgroundColor = ConsoleColor.Red;
            Console.WriteLine("Press enter to continue");
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ReadLine();

            Console.Clear();

            //goes to the lobby
            Lobby.Choice();
        }
Exemple #2
0
        /// <summary>
        /// Lets the user choose what items they want to buy
        /// </summary>
        public static void Choice()
        {
            Player.location = "Shop";


            do
            {
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("You are in the shop");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("You have: £" + Player.money);
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("What do you want to do now?");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("1. ($2)Buy Someone else's fists(+5 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("2. ($5)Buy Stick (+10 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("3. ($10)Buy Metal Chair (+25 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("4. ($16)Buy Gun (+40 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("5. ($30)Buy Wand (+70 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("6. ($79)Buy Nuclear Chicken Launcher (+150 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("7. ($100)Buy Pair of Headphones (+200 dmg)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("8. ($10)Health Potion (+30 Health)");
                Thread.Sleep(Numbers.shortWait);
                Console.WriteLine("9. Back to lobby");

                //makes sure that the input was a number
                do
                {
                    Console.BackgroundColor = ConsoleColor.Red;
                    Console.WriteLine("Please enter a number");
                    Console.BackgroundColor = ConsoleColor.Black;

                    //gets the input
                    Console.ForegroundColor = ConsoleColor.Green;
                    input = Console.ReadLine();

                    Console.ForegroundColor = ConsoleColor.White;
                } while (!Int32.TryParse(input, out ninput));


                switch (ninput)
                {
                case 1:
                    BuyWeapon(2, "Someone else's fists", 5);
                    break;

                case 2:
                    BuyWeapon(5, "Stick", 10);
                    break;

                case 3:
                    BuyWeapon(10, "Metal Chair", 25);
                    break;

                case 4:
                    BuyWeapon(16, "Gun", 40);
                    break;

                case 5:
                    BuyWeapon(30, "Wand", 70);
                    break;

                case 6:
                    BuyWeapon(79, "Nuclear Chicken Launcher", 150);
                    break;

                case 7:
                    BuyWeapon(100, "Pair of Headphones", 500);
                    break;

                case 8:
                    BuyPotion(10);
                    break;

                case 9:
                    Console.Write("Traveling to lobby");
                    Thread.Sleep(Numbers.shortWait);
                    Console.Write(".");
                    Thread.Sleep(Numbers.shortWait);
                    Console.Write(".");
                    Thread.Sleep(Numbers.shortWait);
                    Console.WriteLine(".");
                    Console.Clear();
                    Lobby.Choice();
                    break;
                }
            } while (true);
        }