Show the Letters That a Player Finds

In the previous lesson, we introduced a routine named word_info. Although we didn’t add anything new to our game, we did improve its behavior and make it more efficient.

Improving the word_info routine

Now we need to show the correct letters in the proper position. We will improve the routine that we just wrote to show the letter. We also need the letter that the player proposed to be able to show it. We must join the letter with the hidden word when sending the word_info message.

Note: By using routines, notice how we can focus just on this need without thinking about the rest of the game. We can simply show the number of unknown letters and the letter that the player just found at the correct position.

Get hands-on with 1200+ tech skills courses.