We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I am very new to processing and am trying to make a Hangman style game where users fill in the blanks.
When the correct letter is pressed (keyPressed) then it appears and when an incorrect letter is pressed, the word "incorrect" comes up. I don't even know where to start on how to make sure my sketch / processing:
Can anyone help me with this?
Answers
Look at keyPressed() and key
basically you have a solution word e.g.
String Solution = "TIGER";
Now let's say User entering T
Have a var to count how many letters have been entered by user countInput
Now say
Use the last var to decide how many parts of hangman you'll draw
mine is not fully correct
Don't you have to loop through the characters?
If you have, like Chrisir said a
String solution = "TIGER";
And want to check if the entered character T is in the word, you have a loop like this:The idea is that you have a boolean for each character in the word, when the character's boolean is set to true, you draw that character on the screen. So now you have checked if the entered character is in the word, but you still have to check if the entered character is not in the word... We can do that by adding a few lines.
Now we start by setting a counter to 0 and then if the entered character doesn't match any of the characters in the solution, then we run a falseChar() function that you have to create.
@Stacey :
there are some tricks used, but don't be discouraged:
lines 53 to 56 just make all inputs like a to A
lines 69 to 71 just insert the correct letter in the word _____ with the found (already guessed correctly) letters "showLettersFound", so _____ becomes G etc.