Our VB Hangman game is originated from the paper and pencil guessing game for two or more players. The game starts with one player thinks of a word and the other player tries to guess it by suggesting letters within a certain number of guesses.
The hidden word is represented by a row of dashes, representing each letter of the word. If the player correctly guesses a letter in the word, the other player writes it down in all its correct positions. If the suggested letter does not occur in the word, the other player draws one element of a hanged man figure as a tally mark, starting with the head, following by the body then the arm and so forth.
In addition, the guesser has the option of guessing the whole word when he thinks he has enough clues. If the word is correct, the game is over and the guesser wins. Otherwise, the other player penalizes the guesser by adding an element to the diagram. On the other hand, if the guesser commits enough number of incorrect guesses that allows the opponent to complete the hangman diagram, the game is also over, and the guesser loses. However, the guesser can also win by guessing all the letters or numbers that appear in the word, before the diagram is completed.
In our program, we need to draw a hangman diagram. I suggest you use the Line control to draw the diagram. It is also advisable to convert the Line control into a control array so that we can program it easily using a Loop or the If…Then…Else statement. In addition, we also need to place several Label controls onto the form for the purpose of displaying the letters. These Label controls also need to be converted into a control array and also make invisible at startup or replaying the game. Besides that, we also need to place several Line control below the Label control and make them as a control array and invisible at startup. Last but not least, we also need to design a keyboard by placing 26 command buttons onto the form for the user to choose the alphabet. We follow the design of the standard computer keyboard. The buttons must also be converted to a control array.
We will show you how to write the code in our newest book, Visual Basic Sample Codes Made Easy Ed 2.0 to be launched soon. Please check back regularly.
The Interface