Browse Source

fixed 'l' instead of '_'

master
school 7 years ago
parent
commit
6a1210ed43
  1. 9
      Hangman.java

9
Hangman.java

@ -19,6 +19,7 @@ public class Hangman extends Application {
private int currentHangmanPart;
private boolean activeGame;
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hangman");
Font gameFont = Font.font("Consolas", 22.0);
@ -73,7 +74,7 @@ public class Hangman extends Application {
//create letterGuesses
this.letterGuesses = new Text[26];// finish this line
for (int i = 0; i < 26; i++) {
String temp = "l";//finish this line
String temp = "_";//finish this line
this.letterGuesses[i] = new Text(temp);
letterGuesses[i].setFont(gameFont);
lettersPane.add(letterGuesses[i], i % 13, i / 13);
@ -187,13 +188,13 @@ public class Hangman extends Application {
//write your code for this method
boolean inSecretWord = this.secretWord.indexOf(s) != -1;
boolean guessed = false;
/* boolean guessed = false;
int i = 0;
while (!guessed && i < this.lettersRevealedSoFar.length) {
guessed = this.lettersRevealedSoFar[i].getText() == s;
i += 1;
}
return inSecretWord && !guessed;
} */
return inSecretWord;// && !guessed;
}
private void checkIfWon(String s, Text statusBox) {
//write your code here

Loading…
Cancel
Save