{"id":6785,"date":"2025-12-11T10:38:02","date_gmt":"2025-12-11T10:38:02","guid":{"rendered":"http:\/\/obsidiansofteducation.com\/?page_id=6785"},"modified":"2026-01-15T18:18:59","modified_gmt":"2026-01-15T18:18:59","slug":"app-inventor-hangman-game-tutorial","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/app-inventor-hangman-game-tutorial\/","title":{"rendered":"App Inventor Hangman Game | MIT App Inventor Hangman Game Tutorial"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">Hello friends,<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Welcome to Obsidian Soft.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Today, we will make the very popular Hangman game in MIT App Inventor.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/snake-game-19-1024x576.jpg\" alt=\"\" class=\"wp-image-6807\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/snake-game-19-1024x576.jpg 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/snake-game-19-300x169.jpg 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/snake-game-19-768x432.jpg 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/snake-game-19-800x450.jpg 800w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/snake-game-19.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Let\u2019s begin.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We need a few images for our hangman. The images have to be in a sequence and have to be the same size. You can draw yourself too. But if you are bad at drawing like me \ud83d\ude00, then you can download them from here.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><a href=\"https:\/\/commons.wikimedia.org\/wiki\/File:Hangman-0.png\" target=\"_blank\" rel=\"noopener\">https:\/\/commons.wikimedia.org\/wiki\/File:Hangman-0.png<\/a>. Right-click on the image and save it to your computer. Then, change the 0 to 1 in the URL and save the Hangman 1 image, and continue doing so until you reach Hangman 6.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We also need a few sound effects. I got these sound effects from Pixabay.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><a href=\"https:\/\/pixabay.com\/sound-effects\/winner-game-sound-404167\" target=\"_blank\" rel=\"noopener\">https:\/\/pixabay.com\/sound-effects\/winner-game-sound-404167<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><a href=\"https:\/\/pixabay.com\/sound-effects\/violin-lose-4-185125\" target=\"_blank\" rel=\"noopener\">https:\/\/pixabay.com\/sound-effects\/violin-lose-4-185125<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, open up MIT App Inventor. Start a new project and call it Hangman.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">First of all, upload the seven images and 2 sound effects in the media section by selecting all of them and dragging them to the media section.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">In screen1\u2019s properties, make the screen orientation portrait.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Drag and drop a vertical arrangement from the layouts palette onto the viewer.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Make the background color yellow, align horizontal center, and height and width both fill parent.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Drag and drop an image component from the user interface palette inside this arrangement. Rename it to hangmanImg. Make the picture the 0 image of the hangman image series and change the height to 25%.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Drag and drop a label below this image. Rename it to wordLbl. Make the font bold, font size 50 and change text to a few dashes&#8212;-. The actual number of dashes will be decided based on the word, so these dashes are just a placeholder.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, we need a few horizontal arrangements for our alphabet buttons.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Drag and drop a horizontal arrangement from the layouts palette below the wordLbl.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Make align horizontal and align vertical both center. Make height 10% and width fill parent.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Drag and drop a button inside this horizontal arrangement from the user interface palette. Rename it to aBtn. Make background color a custom light blue, font bold, font size 25, width 15 %, shape rounded, and text = <strong>A<\/strong>. Drag and drop a label for spacing on the right of this button. Remove all text from it and make the width 1%. Duplicate this space label by selecting it and pressing <strong>Ctrl + C &amp; Ctrl + V <\/strong>on the keyboard for Windows OR <strong>Command + C &amp; Command + V <\/strong>for MacOS. Put it on the left of the aBtn. Now, duplicate aBtn. Rename to bBtn and change the text accordingly to <strong>B<\/strong>. Duplicate a space label and place it between the a and b buttons. Keep on doing the same thing for the first 6 buttons. The last button <strong>F <\/strong>&nbsp;will be a little tricky, so temporarily make its width 5% to put space on the right of fBtn and then make it 15% again.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">After the first row of buttons, your screen should look like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"366\" height=\"705\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image.png\" alt=\"\" class=\"wp-image-6786\" style=\"width:235px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image.png 366w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-156x300.png 156w\" sizes=\"auto, (max-width: 366px) 100vw, 366px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"has-medium-font-size\">Now, select the entire horizontal arrangement and duplicate it. Rename buttons to gBtn, hBtn, iBtn, jBtn, kBtn, and lBtn, and respectively change the text to G, H, I, J, K, and L.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Duplicate arrangement again for letters M, N, O, P, Q, R, and then again for S, T, U, V, W, X. Phew! I remember making the calculator app a few years ago, and the duplicate option wasn\u2019t available then!<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Duplicate one more time. This time, remove all buttons except 2 (for X and Y) and a space label in between them. Select this arrangement and duplicate it.&nbsp;<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We need a status label and a restart button here. So duplicate label. Rename it to statusLbl. Make font bold and font size 20. Change text to \u201cGuess a letter!\u201d. Remove the extra button. Rename the remaining button to restartBtn. Make font bold, font size 18, make width automatic, and change text to \u201cRestart\u201d. Verify that all buttons have the correct letters on them. It is super important as the text on them will be used in code. Lastly, add a clock from sensors. And uncheck the timer enabled and timer always fires checkboxes. And make time interval: 3000. This is for adding a short delay before displaying a new hangman word.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, add two sound components from the media palette. Rename one to winSound with source set to the win sound effect. Rename the other one, loseSound, with the source set appropriately to the lose sound effect.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">The UX design is done, so let\u2019s go to the blocks section.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We need a few global variables.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">A master word list for containing the words of the game. For the sake of simplicity, I am hard-coding the words inside the game. You can store your words in a Google Sheet or Firebase DB and load them too. I have done multiple tutorials on Sheets and Firebase DB.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"958\" height=\"262\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-1.png\" alt=\"\" class=\"wp-image-6787\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-1.png 958w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-1-300x82.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-1-768x210.png 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">The other global variables are for the dash \u201c-\u201d, the list of game words, the word chosen for one session of the game, the number of wrong guesses made so far, the word actually being displayed on the screen, which is actually a list of letters, and the score.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"437\" height=\"258\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-2.png\" alt=\"\" class=\"wp-image-6788\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-2.png 437w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-2-300x177.png 300w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">From procedures, get the first type of procedure and rename it to showNewWord.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"338\" height=\"122\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-3.png\" alt=\"\" class=\"wp-image-6789\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-3.png 338w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-3-300x108.png 300w\" sizes=\"auto, (max-width: 338px) 100vw, 338px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Then, make a procedure for restarting the game where we first copy the master words list into our gameWords list. Then, we reset the score to 0, and we also call the showNewWord procedure. Make sure to use the<strong> copy block<\/strong> for copying the master words list.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"224\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-4-1024x224.png\" alt=\"\" class=\"wp-image-6790\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-4-1024x224.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-4-300x66.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-4-768x168.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-4.png 1078w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">We call the restartGame procedure when the screen is initialized.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"416\" height=\"130\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-5.png\" alt=\"\" class=\"wp-image-6791\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-5.png 416w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-5-300x94.png 300w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Then, we make a helper procedure for enabling and disabling the alphabet buttons. The alphabet buttons are all buttons except the restartBtn. We can get the list of buttons by using any component blocks.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"886\" height=\"414\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-6.png\" alt=\"\" class=\"wp-image-6792\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-6.png 886w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-6-300x140.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-6-768x359.png 768w\" sizes=\"auto, (max-width: 886px) 100vw, 886px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"488\" height=\"525\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-7.png\" alt=\"\" class=\"wp-image-6793\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-7.png 488w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-7-279x300.png 279w\" sizes=\"auto, (max-width: 488px) 100vw, 488px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">The job of the showNewWord procedure is to set up the screen for the new word. It is a bit long, but I will explain everything while we build it.<br>First, we check that we still have remaining words in our gameWords list using a control if\/else block. Else means that we have used up all the words in our game words list and the game is over, so we update the statusLbl accordingly with the score.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"318\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-8-1024x318.png\" alt=\"\" class=\"wp-image-6794\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-8-1024x318.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-8-300x93.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-8-768x239.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-8.png 1410w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">In the if block, the game is still continuing as we still have words left in the gameWords list. We pick a random word from the game words list and set it to chosenWord. And we also remove that chosen word from the gameWords list so that it doesn\u2019t come again in that session of the game. This is the reason why we used the copy block for copying the master list. If we hadn\u2019t, the word would have been removed from our master words list, too. We reset wrong guesses to 0 and make the display Word an empty list.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"516\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-9-1024x516.png\" alt=\"\" class=\"wp-image-6795\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-9-1024x516.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-9-300x151.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-9-768x387.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-9.png 1410w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Then, we need to run a for loop to add dashes to our display word.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"477\" height=\"178\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-11.png\" alt=\"\" class=\"wp-image-6798\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-11.png 477w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-11-300x112.png 300w\" sizes=\"auto, (max-width: 477px) 100vw, 477px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Then, we set our wordLbl on the screen to join all the letters in the list of displayWord.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"74\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-10.png\" alt=\"\" class=\"wp-image-6796\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-10.png 640w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-10-300x35.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Then, we reset our hangman image to the 0.png image. We reset statusLbl to \u201cGuess a letter!\u201d and we enable all our alphabet buttons using our custom procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"437\" height=\"119\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-12.png\" alt=\"\" class=\"wp-image-6797\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-12.png 437w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-12-300x82.png 300w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">So the final showNewWord procedure looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"951\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-14-1024x951.png\" alt=\"\" class=\"wp-image-6800\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-14-1024x951.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-14-300x279.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-14-768x714.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-14.png 1410w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Now, make an empty procedure for what should happen when an alphabet key is pressed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"406\" height=\"122\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-13.png\" alt=\"\" class=\"wp-image-6799\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-13.png 406w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-13-300x90.png 300w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">But how do we know that an alphabet key has been pressed.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We can use Any component -&gt; Any button -&gt; When any button click event.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">We check if the component (button clicked) is the restartBtn. In that case, we call the restartGame procedure. Otherwise, it means it is an alphabet button, so first we disable it so that the user can know he has already used that button, and then we call the guessLetter procedure with the text on the button being the input. This is why I said earlier that the text on the alphabet buttons is very important.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"618\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-16-1024x618.png\" alt=\"\" class=\"wp-image-6802\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-16-1024x618.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-16-300x181.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-16-768x463.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-16.png 1028w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Now, we work on our main game logic block, i.e., the guessLetter procedure. We make a local variable called found and initialize it to false.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"202\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-15.png\" alt=\"\" class=\"wp-image-6801\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-15.png 634w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-15-300x96.png 300w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">We run a for loop where the number of times the for loop is run is equal to the length of our displayWord, and we check if the letter is a segment in our chosenWord. Use the segment block from text very carefully. If we find the letter at a position, we replace the dash in the display word at that position with the letter, and we also set found = true because our guess has been correct. We are using a for loop here so that we can update repeating letters. For example, if the user presses \u201cP\u201d for the word \u201cAPPLE\u201d, two Ps will be put at their correct positions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"713\" height=\"357\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-17.png\" alt=\"\" class=\"wp-image-6803\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-17.png 713w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-17-300x150.png 300w\" sizes=\"auto, (max-width: 713px) 100vw, 713px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">After the for loop ends, we use an if-else block to differentiate between a correct guess and a wrong guess, and in case of a correct guess, we update the wordLbl on the screen too.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"160\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-18.png\" alt=\"\" class=\"wp-image-6804\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-18.png 743w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-18-300x65.png 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">In the if condition, there is a chance that we have guessed all the letters in the word, so we use another if block to check if there are no dashes in the display word, and if there are none, we play a win sound. We update statusLbl, disable the alphabet buttons temporarily, increment score (add a 1 to it), and enable our 3-second timer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"329\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-19.png\" alt=\"\" class=\"wp-image-6805\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-19.png 693w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-19-300x142.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Otherwise, we increment the number of wrong guesses, and we use it to construct our hangmanImg. We also check for the loss condition, i.e., all guesses used (6). In that situation, we play the loseSound. We update statusLbl. We show the correct word in the wordLbl, enable the 3-second timer, and disable the alphabet buttons temporarily.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"403\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-21.png\" alt=\"\" class=\"wp-image-6811\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-21.png 719w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-21-300x168.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Last is the 3-second timer event. Here we will first disable the timer and call the showNewWord procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"182\" src=\"http:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-20.png\" alt=\"\" class=\"wp-image-6806\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-20.png 774w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-20-300x71.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/12\/image-20-768x181.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">So, this is done. I hope you like the tutorial.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">You can also get the AIA Project file from here:<\/p>\n\n\n\n<p class=\"has-vivid-cyan-blue-color has-text-color has-link-color has-medium-font-size wp-elements-f73c21fa3385d61a3d70432fb40d361a\"><strong><a href=\"https:\/\/obsidiansoft.gumroad.com\/l\/erjtp\" target=\"_blank\" rel=\"noopener\">Get the AIA File for Hangman Game<\/a><\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\">You can also check out the video tutorial for this project on my channel.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Part 1:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"MIT App Inventor Hangman Game Tutorial (Part 1\/2) |  Hangman App Inventor | App Inventor Games\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/D--zP02cWN0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Please like my tutorials and share it with your friends and family. Also, subscribe to my channel and press the bell icon so you don\u2019t miss any of the great projects I have planned for you.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Facebook:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Instagram:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.instagram.com\/obsidiansoftapps\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Pinterest:<\/strong>&nbsp;<a href=\"https:\/\/www.pinterest.com\/obsidiansoft\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pinterest.com\/obsidiansoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">For links to free educational&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/flappy-bird-game-mit-app-inventor\/#\">&nbsp;apps<\/a>, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\">educational apps page<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, Welcome to Obsidian Soft. Today, we will make the very popular Hangman game in MIT App Inventor.&nbsp; Let\u2019s begin. We need a few images for our hangman. The images have to be in a sequence and have to be the same size. You can draw yourself too. But if you are bad at [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6785","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=6785"}],"version-history":[{"count":5,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6785\/revisions"}],"predecessor-version":[{"id":6863,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6785\/revisions\/6863"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=6785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}