Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Namnge din tamagotchi:");
            String Namn = Console.ReadLine();

            tamagotchi t = new tamagotchi();

            t.name = Namn;

            Console.WriteLine("Lär din tamagotchi ett nytt ord: ");
            string word = Console.ReadLine();

            t.Teach(word);

            t.Hi();

            t.GetAlive();

            t.Tick();

            Console.WriteLine("Skriv 'print' för att kolla dina stats: ");
            string stats = Console.ReadLine();



            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            tamagotchi player1 = new tamagotchi();

            Console.WriteLine("Please enter a name for your tamagotchi:");
            player1.name = Console.ReadLine();
            Console.Clear();

            bool alive = player1.GetAlive();

            while (alive == true)
            {
                Console.WriteLine(player1.name);
                player1.PrintStats();
                Console.WriteLine("---------------------------------------");
                Console.WriteLine("What do you wish to do? (Type number)\n");
                Console.WriteLine("1. Teach your tamagotchi");
                Console.WriteLine("2. Greet your tamagotchi");
                Console.WriteLine("3. Feed your tamagotchi");
                Console.WriteLine("4. Do nothing");

                string answer = Console.ReadLine();

                if (answer == "1")
                {
                    Console.WriteLine("What word do you wish to teach " + player1.name + "?");

                    string wordTeach = Console.ReadLine();

                    player1.Teach(wordTeach);
                    player1.Tick();

                    Console.Clear();
                }

                else if (answer == "2")
                {
                    Console.WriteLine("Your tamagotchi looks for a word to respond with...");
                    player1.Hi();

                    player1.Tick();

                    Console.ReadLine();
                    Console.Clear();
                }

                else if (answer == "3")
                {
                    Console.WriteLine("You give " + player1.name + " some food.");
                    player1.Feed();

                    player1.Tick();

                    Console.ReadLine();
                    Console.Clear();
                }

                else if (answer == "4")
                {
                    Console.WriteLine("You stare at " + player1.name + ", but you do nothing...");

                    player1.Tick();

                    Console.ReadLine();
                    Console.Clear();
                }

                else
                {
                    Console.WriteLine("Please select a number between 1-4.");
                    Console.ReadLine();
                    Console.Clear();
                }

                alive = player1.GetAlive();
            }

            if (alive == false)
            {
                Console.WriteLine(player1.name + " has died.");
                Console.WriteLine("RIP");

                Console.ReadLine();
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            tamagotchi spelare = new tamagotchi();

            bool   Alive    = true;
            bool   Talkable = false;
            string svar     = "";

            System.Console.WriteLine("What is your name?");
            string name = Console.ReadLine();

            while (Alive == true)
            {
                Alive = spelare.GetAlive();
                spelare.Tick();
                Console.WriteLine("What do you want to do? \n[1]Feed\n[2]Talk\n[3]Teach\n[4]Stats\n[5]Skip");
                svar = Console.ReadLine().ToLower();

                if (svar == "feed")
                {
                    spelare.Feed();
                    Console.WriteLine("Nom nom nom");
                }
                else if (svar == "talk")
                {
                    if (Talkable == true)
                    {
                        System.Console.Write(name + " said ");
                        spelare.Hi();
                    }
                    else
                    {
                        Console.WriteLine("I don't know any words");
                    }
                }
                else if (svar == "teach")
                {
                    System.Console.WriteLine("What new word do you want to learn?");
                    string nyttOrd = Console.ReadLine();
                    spelare.Teach(nyttOrd);
                    Console.WriteLine(name + " learned the word " + nyttOrd);
                    Talkable = true;
                }
                else if (svar == "stats")
                {
                    spelare.PrintStats();
                }
                else if (svar == "skip")
                {
                }
                else
                {
                    Console.WriteLine("Write one of the alternatives)");
                    svar = Console.ReadLine().ToLower();
                }
                Thread.Sleep(500);
                Console.Clear();
            }

            System.Console.WriteLine("You died :)");
        }