Click here to play my game.
I chose to create Galaga Hangman, designed and named after the old arcade game. Your only chance of surviving the evil space-bug attack is correctly solving for the mystery word. Unlike the game, this version of Galaga leaves you with no ammunition; your five ships are picked-off one by one as you choose the wrong letters. The dictionary is related to the theme of the game but has some additional Sci-Fi terms and concepts thrown in.
Overall this project turned out to be a bit of challenge. My first real roadblock was unfortunately due to a poor decision I made early on in my code. My ‘letter counter’ counted not only the letters within the word but also the commas used to split that string. I added an additional function, “join,” which at the time seemed to work great. My letter counter started performing and giving me the correct output. Later, however, when I was trying to create a check guess function nothing seemed to work. It took a while to realize that it could not examine the individual pieces of the array because I had essentially joined them back into a string.
A further mistake was labeling my current word array as a string. I am not sure when or why I changed this. The result however, was that the current word array could never be equal to the contents of the last text field selected. They were simply not the same kind of thing.
The check guess function turned out to be the most difficult issue to solve. Apart from the errors that I mentioned previously, setting up the for loop and its surrounding logic took some thought. I eventually used a local Boolean variable. This made it simpler to define states that could be viewed in terms of true or false. I used this same method later to determine whether or not the player had won.
The last big issue I encountered was playing my movie clip. I needed to play more than one frame at a time. It turned out this could not be done by simply using gotoAndPlay with gotoAndStop in combination. Instead, at the end of each section of frames I needed to add stop();directly to the code of my movie in the fla. file. This way I could start the clip with gotoAndPlay in ActionScript and then allow the clip to stop itself.
Although this project was definitely a stretch for me, it noticeable solidified my understanding of the concepts we have used thus far. I feel as though I now have a fairly well founded grasp on for loops. Additionally, I had the opportunity to test out techniques I was a little fuzzy on like Boolean variables or functions such as charAt. Overall, it was a helpful exercise to have completed.