Hang Me Baby One More Time

My game is called Pop Star Hangman, inspired by my iPod, and my hangman visual is Britney Spears’ hairstyle. This was actually kind of a fun project and ended up not being as much code as I thought. The problem was finding the right code. My biggest problems were essentially the three things needed to run the game: getting the game to recognize which letter each button corresponded to, actually display that letter in the output box (especially to get it to display two instances of the same letter), and how to let the game know the player won.

The button to letter issue was fairly easy once I went to the “Actionscript Bible” that’s in the lab. That book literally had everything I needed, and I only had to consult the internet a couple times when I was unsure how to implement certain methods. I found the event.target.name function, and by slicing some of the string was able to then convert it to a number I could use to correspond to the alphabet array. I became very familiar with the .search and .indexOf methods and used that to figure out which letter belonged in which output box. I then just created variables that measured this and inserted it into a this[ “outputBox” + var].text line of code that spit the letter out onto the board. The final obstacle was how to let the game know the player won. I tried everything, even putting “if” statements inside for loops. In the end I came up with the solution by creating a variable that counted whenever a letter was displayed, and when that equaled the length of the wordLetters array, the player won.

In the end, it seems like most of this coding was just convert ints to strings and vice versa. Having completed this, I’m looking forward to making more games. Play here!

Don't let Britney lose her hair!


About andrewmoritz

Disney Disney Disney
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s