private void arrowt1_Click(object sender, EventArgs e) { if (gc.getPlayerInfo().getArrows() != 0) { gc.getPlayerInfo().removeArrows(); if ((surroundingRoom[0] == gc.getMap().getWumpusPosition())) { var winMessage = MessageBox.Show("YOU WON <3"); TitleScreen form = new TitleScreen(); gc.getHighScore().addHighScore(gc.getPlayerInfo().getScore()); form.Show(); form.Activate(); this.Hide(); } } else if (gc.getPlayerInfo().getArrows() == 0) { var message = MessageBox.Show("You do not have any arrows"); } update(); }
public WumpusGraphics(TitleScreen form) { this.form = form; }
private void update() { surroundingRoom = gc.getMap().getConnectedRooms(gc.getMap().getPlayerPosition(), 1); int cave1Int = surroundingRoom[0]; int cave2Int = surroundingRoom[1]; int cave3Int = surroundingRoom[2]; int currentRoom = gc.getMap().getPlayerPosition(); int scoreVal = gc.getPlayerInfo().getScore(); int goldVal = gc.getPlayerInfo().getGold(); int arrowVal = gc.getPlayerInfo().getArrows(); cavet1.Text = cave1Int.ToString(); cavet2.Text = cave2Int.ToString(); cavet3.Text = cave3Int.ToString(); score.Text = "score: " + scoreVal.ToString(); gold.Text = "gold: " + goldVal.ToString(); arrowCount.Text = "arrows: " + arrowVal.ToString(); const String shootT = "shoot at: "; arrowt1.Text = shootT + cave1Int.ToString(); arrowt2.Text = shootT + cave2Int.ToString(); arrowt3.Text = shootT + cave3Int.ToString(); CurrentRoomNum.Text = "Current Room: " + currentRoom; Console.WriteLine("pit: " + printArray(gc.getMap().getPitPosition())); Console.WriteLine("bat: " + printArray(gc.getMap().getBatPosition())); Console.WriteLine("wumpus: " + gc.getMap().getWumpusPosition().ToString()); Console.WriteLine("player: " + gc.getMap().getPlayerPosition().ToString()); if(gc.getMap().isWumpusWithPlayer()) { shark.BringToFront(); shark.Visible = true; var meesage = MessageBox.Show("YOU CANT FIGHT HIM :(\nhe is too strong.\nWumpus will run away."); gc.getMap().generateRandomWumpusPosition(); shark.Visible = false; update(); /*TRIVIA? var message = MessageBox.Show("YOU ARE WITH THE invisible WUMPUS...OH NO D:"); TriviaForm1 trivia = new TriviaForm1(); trivia.ShowDialog(); bool wonTrivia = trivia.WonGame; */ //TODO: implement a way to pop up trivia. } if(gc.getMap().isPitWithPlayer()) { label1.BringToFront(); label1.Visible = true; var message = MessageBox.Show("ouchie..you died in the PIT :( \nGame Over..sorry"); TitleScreen form = new TitleScreen(); gc.getHighScore().addHighScore(gc.getPlayerInfo().getScore()); form.Show(); form.Activate(); this.Hide(); } if(gc.getMap().isBatWithPlayer()) { bats.Visible = true; gc.getMap().generateRandomPlayerPosition(); String position = gc.getMap().getPlayerPosition().ToString(); var message = MessageBox.Show("watch out..there are invisible bats.\nyou will now be teleported to: cave " + position); bats.Visible = false; update(); } if(gc.getMap().areBatsNear()) { var message = MessageBox.Show("I hear those horrible bats"); } if(gc.getMap().isPitNear()) { var message = MessageBox.Show("My pit senses are tingling"); } if(gc.getMap().isWumpusNear()) { var message = MessageBox.Show("I HEAR THE DEADLY WUMPUS"); } }