private void move_Click(object sender, EventArgs e) { if (player.validMove(controlInput) || controlInput.Length > 0) { player.Move(controlInput); if (map.getPlayerIndex() == "W") { playerOpposite.Image = Image.FromFile(graphicalInterface.displayPit()); status.Text = "You are in the same cave as the Wumpus!"; Thread.Sleep(1500); player.WumpTrivia(); } if (map.getPlayerIndex() == "D") { playerOpposite.Image = Image.FromFile(graphicalInterface.displayPit()); status.Text = "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(graphicalInterface.displayBat()); status.Text = "You have run into a bat! You're getting moved!"; map.randomizePlayer(); } goldBox.Text = "Total Gold: " + player.getGold(); scoreBox.Text = "Total Score: " + player.getScore(); } updateConnections(); }
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(); }
public void newTopTen(Player newScore) { //If the User obtains a new top ten score, mutate topTen array to include new score. If there are already //10 scores, knock the lowest score off the list. //Will be called by Player Object. if (newScore.getScore() > this.topTen[9].getScore()) { int check = 0; while (check < limitTop && newScore.getScore() > topTen[9 - check].getScore()) { check++; } for (int a = 1; a < check; a++) { this.topTen[limitTop - a] = topTen[9 - a]; } this.topTen[limitTop - check] = newScore; } }