Exemplo n.º 1
0
 private void move_Click(object sender, EventArgs e)
 {
     if (map.validRoom(controlInput) && controlInput.Length > 0)
     {
         player.Move(controlInput);
         scoreBox.Text = "Total Score: " + player.getScore();
         goldBox.Text  = "Total Gold: " + player.getGold();
         turn.Text     = "Total Turns: " + player.getTurns();
         map.moveBat();
         map.moveWumpus();
         if (map.getPlayerIndex() == "W")
         {
             playerOpposite.Image = Image.FromFile(@"C:\Users\pumpk\Google Drive\HuntTheWumpus-20180608T021536Z-001\HuntTheWumpus\Images\pit.bmp");
             System.Windows.Forms.MessageBox.Show("You are in the same cave as the Wumpus!");
             Thread.Sleep(1500);
             if (player.WumpTrivia())
             {
                 System.Windows.Forms.MessageBox.Show("Awesome! You got 2 questions right, allowing you to barely escape the clutches of the Wumpus!");
                 map.wumpusMeetsPlayer();
             }
             else
             {
                 System.Windows.Forms.MessageBox.Show("Sorry, you didn't correctly answer enough questions. You did not escape the Wumpus' grasp. You have been eliminated");
                 this.Hide();
                 (new Lose()).Show();
             }
         }
         if (map.getPlayerIndex() == "D")
         {
             playerOpposite.Image = Image.FromFile(@"C:\Users\pumpk\Google Drive\HuntTheWumpus-20180608T021536Z-001\HuntTheWumpus\Images\Pit.bmp");
             System.Windows.Forms.MessageBox.Show("You have fallen into a ditch! You lose!");
             Thread.Sleep(2000);
             this.Hide();
             (new Lose()).Show();
             Thread.Sleep(2000);
             this.Hide();
             (new HighScores()).Show();
         }
         if (map.getPlayerIndex() == "B")
         {
             playerOpposite.Image = Image.FromFile(@"C:\Users\pumpk\Google Drive\HuntTheWumpus-20180608T021536Z-001\HuntTheWumpus\Images\bat.bmp");
             System.Windows.Forms.MessageBox.Show("You have run into a bat! You're getting moved!");
             map.randomizePlayer();
             playerOpposite.Image = null;
         }
     }
     if (!map.validRoom(controlInput))
     {
         System.Windows.Forms.MessageBox.Show("This path is closed. Please chose an open path through the cave.");
     }
     updateConnections();
     showRoom();
 }