Beispiel #1
0
        public void purchaseArrows()
        {
            Sound s1 = new Sound();
            //call trivia class and ask two questions and return if they got
            //at least 2 or more correct
            int numRight = 0;
            int numQ     = 0;

            while (numRight < 2 && numQ < 3)
            {
                this.gold--;
                Console.WriteLine(questions.askQuestion());
                Console.WriteLine("Pick an Option (A, B, C, or D):");
                String input = Console.ReadLine();
                input.ToLower();
                if (questions.checkAnswer(input))
                {
                    Console.WriteLine("Correct!");
                    numRight++;
                    s1.correct();
                }
                else
                {
                    Console.WriteLine("Incorrect!");
                    s1.incorrect();
                }
                numQ++;
            }
            if (numRight > 2)
            {
                Console.WriteLine("Awesome! You got " + numRight +
                                  "questions right, giving you 2 extra arrows!");
                this.arrows = this.arrows + 2;
                updateScore();
            }
            else
            {
                Console.WriteLine("Sorry, you got " + numRight +
                                  "questios right out of the required two. You did not recieve extra arrows...");
            }
        }
Beispiel #2
0
 private void TriviaForm_Load(object sender, EventArgs e)
 {
     this.correct  = 0;
     Question.Text = questions.askQuestion();
 }