PeanutButter, on 24 Apr, 2009 - 05:23 PM, said:
It has a GUI.
Fuzzyness, on 24 Apr, 2009 - 08:41 PM, said:
333OnlyHalfEvil, on 24 Apr, 2009 - 12:31 AM, said:
Hmm.. why not something like this?
Scanner in = new Scanner(System.in);
boolean play = false;
System.out.print("Do you wish to play?");
if(in.nextLine.charAt(0) == ('y' || 'Y'))
play = true;
String guess;
char charGuess;
while(play)
{
guess = null;// Resets guess to null incase carry over from prev loop round
charGuess = null; // resets the charGuess to null to avoid carry over after loop finishes once
System.out.print("Please enter a letter to guess: ");
guess = input.next();// Scans the letter/word they enter
charGuess = guess.charAt(0); // gets the first char of the enterance just because we know people dont follow directions
for(int i = 0; i<word.length;i++) // assuming you made the word to be guess an array to be checked
if(word[i] == charGuess) // checks the array at i to see if the charGuess is the same as it
dashes[i] = charGuess; //Assuming you made an array of dashes to be guessed, will switch the correct index to the guess letter
}
There is a little example of a piece you may think about. Its not nearly the full game or the code, just a method of switch the chars and showing the word.
The game uses a GUI.
pbl, on 24 Apr, 2009 - 09:10 PM, said:
I'll give the char array a try.
Locke, on 25 Apr, 2009 - 06:13 PM, said:
When you use the ASCII value 0 it gives a little square instead of an empty char.

New Topic/Question
Reply




MultiQuote





|