Exemplo n.º 1
0
        static void Main(string[] args)
        {
            #region Print welcome message and ask for Username

            //printing Welcome message
            Console.WriteLine("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
            Console.WriteLine("WELCOME TO THE ANIMAL GAME");
            Console.WriteLine("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
            Console.WriteLine("BY BRANDON");
            //ask user what their Username is
            Console.WriteLine("What is your Username?");


            //making a variable and capturing the data from the user
            string userInput = Console.ReadLine();

            //Print out the usernamemmnm n
            Console.WriteLine("Hello:" + userInput);


            #endregion

            #region Create Player object and set score to 0
            //created a new instance of Player and set the Username
            Player player1 = new Player();
            player1.Username = userInput;
            player1.Score    = 0;



            Console.WriteLine("player1 Username:"******"player1 Score:" + player1.Score);
            Console.WriteLine("player1 Health:" + player1.Health);
            #endregion


            GameEngine game = new GameEngine();

            for (int i = 1; i <= 10; i++)
            {
                Animal animal1 = game.CatchAnimal();
                Console.WriteLine("animal" + i + " AnimalType:" + animal1.AnimalType);
                Console.WriteLine("animal" + i + " Score:" + animal1.Points);
                Console.WriteLine("animal" + i + " DamageDealt:" + animal1.DamageDealt);

                player1.Score = player1.Score + animal1.Points;

                Console.WriteLine("   Score:" + player1.Score);


                player1.Health = player1.Health - animal1.DamageDealt;
                Console.WriteLine("   Health:" + player1.Health);


                if (player1.Health <= 0)
                {
                    Console.WriteLine("YOU DIED OH NO!!!!!!!!!");
                    break;
                }
            }

            string now = DateTime.Now.ToString("yyyyMMddHHmmsss");

            string filename = "HuntingApp" + now + ".txt";

            Console.WriteLine("******************************************************************************************************************");
            Console.WriteLine("FINAL REPORT CARD");
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("Score:" + player1.Score);
            Console.WriteLine("Health:" + player1.Health);
            if (player1.Health <= 0)
            {
                Console.WriteLine("YOU DIED OH NO!!!!!!!!!");
            }
            using (StreamWriter outputfile = new StreamWriter(filename))
            {
                outputfile.WriteLine("******************************************************************************************************************");
                outputfile.WriteLine("FINAL REPORT CARD");
                outputfile.WriteLine("-------------------------------------------");
                outputfile.WriteLine("Date:" + now);
                outputfile.WriteLine("Username:"******"Score:" + player1.Score);
                outputfile.WriteLine("Health:" + player1.Health);
                if (player1.Health <= 0)
                {
                    outputfile.WriteLine("YOU DIED OH NO!!!!!!!!!");
                }
            }

            //Animal animal1 = game.CatchAnimal();

            //Console.WriteLine("animal1 AnimalType:" + animal1.AnimalType);
            //Console.WriteLine("animal1 Score:" + animal1.Points);

            //player1.Score = player1.Score + animal1.Points;

            //Console.WriteLine("player1 Score:" + player1.Score);


            //player1.Health = player1.Health - animal1.DamageDealt;
            //Console.WriteLine("player1 Health:" + player1.Health);



            //Animal animal2 = game.CatchAnimal();

            //Console.WriteLine("anmal2 AnimalType:" + animal2.AnimalType);
            //Console.WriteLine("animal2 Score:" + animal2.Points);

            //player1.Score = player1.Score + animal2.Points;
            //player1.Health = player1.Health - animal1.DamageDealt;

            //Console.WriteLine("player1 Score:" + player1.Score);
            //Console.WriteLine("player1 Health:" + player1.Health);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            #region Print welcome message and ask for Username
            //printing Welcome message
            Console.WriteLine("====================================");
            Console.WriteLine("WELCOME TO THE HUNTING GAME");
            Console.WriteLine("BY: FRED");
            Console.WriteLine("====================================");

            //ask user for their username
            Console.WriteLine("What is your Username?");

            //making a variable userInput and capturing the data from the user
            string userInput = Console.ReadLine();

            //Print out the user name
            Console.WriteLine("Hello:" + userInput);

            #endregion

            #region Create Player object and set score to 0
            //created a new instance of Player and set the Username and print out
            Player player1 = new Player();
            player1.Username = userInput;
            player1.Score    = 0;

            Console.WriteLine("player1 Username:"******"player1 Score:" + player1.Score);

            #endregion


            GameEngine game = new GameEngine();

            for (int i = 1; i <= 10; i++)
            {
                Animal animal1 = game.HuntAnimal();

                Console.WriteLine("animal" + i + " AnimalType:" + animal1.AnimalType);
                Console.WriteLine("animal" + i + " Points:" + animal1.Points);
                Console.WriteLine("animal" + i + " Damage Dealt:" + animal1.DamageDealt);

                //add fish points to Player Score
                player1.Score = player1.Score + animal1.Points;
                Console.WriteLine("player" + i + " Score:" + player1.Score);

                player1.Health = player1.Health - animal1.DamageDealt;
                Console.WriteLine("player" + i + " Health:" + player1.Health);

                if (player1.Health <= 0)
                {
                    Console.WriteLine("YOU DIED!!!!!!!");
                    break;
                }
            }


            Console.WriteLine("************************************************");
            Console.WriteLine("FINAL REPORT CARD");
            Console.WriteLine("-----------------");
            Console.WriteLine("Score:" + player1.Score);
            Console.WriteLine("Health:" + player1.Health);

            if (player1.Health <= 0)
            {
                Console.WriteLine("YOU DIED!!!!!!!");
            }


            string now      = System.DateTime.Now.ToString("yyyyMMddHHmmsss");
            string filename = "huntingapp" + now + ".txt";

            using (StreamWriter outputFile = new StreamWriter(filename))
            {
                outputFile.WriteLine("************************************************");
                outputFile.WriteLine("FINAL REPORT CARD");
                outputFile.WriteLine("-----------------");
                outputFile.WriteLine("Date:" + now);
                outputFile.WriteLine("Username:"******"Score:" + player1.Score);
                outputFile.WriteLine("Health:" + player1.Health);

                if (player1.Health <= 0)
                {
                    outputFile.WriteLine("YOU DIED!!!!!!!");
                }
            }


            //Animal animal1 = game.HuntAnimal();

            //Console.WriteLine("animal1 FishType:" + animal1.AnimalType);
            //Console.WriteLine("animal1 Points:" + animal1.Points);

            ////add fish points to Player Score
            //player1.Score = player1.Score + animal1.Points;
            //Console.WriteLine("player1 Score:" + player1.Score);



            ////GameEngine game2 = new GameEngine();
            //Animal animal2 = game.HuntAnimal();

            //Console.WriteLine("animal2 FishType:" + animal2.AnimalType);
            //Console.WriteLine("animal2 Points:" + animal2.Points);



            ////add fish points to Player Score
            //player1.Score = player1.Score + animal2.Points;
            //Console.WriteLine("player1 Score:" + player1.Score);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            #region Print welcome message and ask for username

            //printing welcome mesage
            Console.WriteLine("**********************************************Welcome to the hunting game***************************");
            Console.WriteLine("By Matthew");
            //asking user what their name is
            Console.WriteLine("what is your username");

            //making a varible called userName and capturing the data from the user
            string userInput = Console.ReadLine();

            //printing the varible
            Console.WriteLine("hello " + userInput);

            #endregion
            #region create player object and set score to 0
            //created a new instance and set the username
            Player player1 = new Player();
            player1.Username = userInput;
            player1.Score    = 0;
            player1.Health   = 100;

            Console.WriteLine("player  username: "******"player Score: " + player1.Score);
            Console.WriteLine("player  health: " + player1.Health + "hp");
            #endregion



            GameEngine game = new GameEngine();

            for (int attempt = 1; attempt <= 10; attempt++)
            {
                Console.WriteLine("attempt = " + attempt);
                Animal animal1 = game.HuntAnimal();
                Console.WriteLine("animal " + attempt + " animalType " + animal1.AnimalType);
                Console.WriteLine("animal " + attempt + animal1.Points);
                Console.WriteLine(" this animal has done : " + animal1.DamageDealt);

                player1.Score = player1.Score + animal1.Points;
                Console.WriteLine("       Score " + player1.Score);
                player1.Health = player1.Health - animal1.DamageDealt;
                Console.WriteLine("     your health right now is :" + player1.Health);

                if (player1.Health <= 0)
                {
                    Console.WriteLine("You are dead meat for the animals. You are very juicy too to them.");
                    break;
                }
                else
                {
                    Console.WriteLine("try again");
                }
            }
            Console.WriteLine("*******************************************************************");
            Console.WriteLine("FINAL RESULT");
            Console.WriteLine("player1 Score: " + player1.Score);
            Console.WriteLine("player1 health: " + player1.Health);
            if (player1.Health <= 0)
            {
                Console.WriteLine("You are dead meat for the animals. You are very juicy too to them.");
            }
            else
            {
                Console.WriteLine("you have won because your health was over 0!!!!!");
            }

            string now      = System.DateTime.Now.ToString("yyyyMMddHHmmsss");
            string filename = "huntingapp" + now + ".txt";
            using (StreamWriter outputfile = new StreamWriter(filename))
            {
                outputfile.WriteLine("*******************************************************************");
                outputfile.WriteLine("FINAL RESULT");
                outputfile.WriteLine("Date:" + now);
                outputfile.WriteLine("Username:"******"player Score: " + player1.Score);
                outputfile.WriteLine("player health: " + player1.Health);
                if (player1.Health <= 0)
                {
                    outputfile.WriteLine("You are dead meat for the animals. You are very juicy too to them.");
                }
                else
                {
                    outputfile.WriteLine("you have won because your health was over 0!!!!!");
                }
            }



            //Animal animal1 = game.HuntAnimal();

            //Console.WriteLine("animal 1 animalType " + animal1.AnimalType);
            //Console.WriteLine("animal1 points " + animal1.Points);
            //Console.WriteLine(" this animal has done : " + animal1.DamageDealt);

            //player1.Score = player1.Score + animal1.Points;
            //Console.WriteLine("player1 Score " + player1.Score);
            //player1.Health = player1.Health - animal1.DamageDealt;
            //Console.WriteLine("your health right now is :" + player1.Health);


            //Animal animal2 = game.HuntAnimal();

            //Console.WriteLine("animal 2 animalType " + animal2.AnimalType);
            //Console.WriteLine("animal 2 points " + animal2.Points);
            //Console.WriteLine(" this animal has done : " + animal2.DamageDealt);

            //player1.Score = player1.Score + animal2.Points;
            //Console.WriteLine("player1 Score " + player1.Score);
            //player1.Health = player1.Health - animal2.DamageDealt;
            //Console.WriteLine("your health right now is :" + player1.Health);


            //Animal animal3 = game.HuntAnimal();

            //Console.WriteLine("animal 3 animalType " + animal3.AnimalType);
            //Console.WriteLine("animal 3 points " + animal3.Points);
            //Console.WriteLine(" this animal has done : " + animal3.DamageDealt);

            //player1.Score = player1.Score + animal3.Points + animal3.Points;
            //Console.WriteLine("player1 Score " + player1.Score);
            //player1.Health = player1.Health - animal3.DamageDealt;
            //Console.WriteLine("your health right now is :" + player1.Health);

            //if (player1.Health <= 0)
            //{
            //    Console.WriteLine("You are dead meat for the animals. You are very juicy too to them.");
            //}
            //else
            //{
            //    Console.WriteLine("you have won!!");
            //}

            //for (int attempt = 1; attempt <= 5; attempt++)
            //{
            //    Console.WriteLine("attempt = " + attempt);
            //}
        }