コード例 #1
0
ファイル: Program.cs プロジェクト: jeslaa/Tamagotchi
        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();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            tamagotchi t1 = new tamagotchi("Luna", "M", 100, 100);

            Console.WriteLine("Name: {0}, Gender: {1}, Fullness: {2}, Happiness: {3}", t1.getName(), t1.getGender(), t1.getFullness(), t1.getHappiness());
            //Console.ReadLine();
            while (t1.getHappiness() > 0 && t1.getFullness() > 0)
            {
                Console.WriteLine("Would you like to pet or feed {0}?", t1.getName());
                string input = Console.ReadLine();

                if (input == "pet")
                {
                    t1.pet();
                }
                else if (input == "feed")
                {
                    t1.feed();
                }
                else
                {
                    Console.WriteLine("Please only use 'pet' or 'feed'.");
                }
                t1.dostuff();
                Console.WriteLine("Name: {0}, Gender: {1}, Fullness: {2}, Happiness: {3}", t1.getName(), t1.getGender(), t1.getFullness(), t1.getHappiness());
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Calle1122/Tamagotchi
        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();
            }
        }
コード例 #4
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 :)");
        }