Game Overview


As someone who loves physics, I usually like to create games that have a lot of physically realistic movement, like pool, pinball, or miniature golf. But one day I noticed my wife playing a word-search game from a tiny book she'd just bought. She jokingly asked me, "Why can't you make a game like this?" So I did, and this is it!

Before beginning the task of creating Word Search, I thought, how hard can it be? It turns out that although it wasn't too terribly difficult, it was much harder than I had initially thought. It took me quite a bit of time to come up with a plan for coding this game.

The game of Word Search is easy to understand. It has a grid of letters that can be any size. In this game we use 17 by 17 letters. There is a list of words that can be found within this grid. Words may be positioned vertically, horizontally, or diagonally (and either spelled forward or backward in any of these directions). In this Flash Word Search version, I have enabled words in all directions except diagonal stretching from upper right to lower left.

graphics/14fig01.gif

When playing a word-search game on paper, you typically circle a word when you find it, or you mark through it. You also mark it off the list so that you can easily see which words you still have left to find. It's the same in this Flash version. When you find a series of letters you wish to select, you click and hold the first letter, and drag toward the last letter you want to include. As you drag, an oval is drawn along your path of movement. When you reach the last letter, you release the mouse button. If the letters you selected match a word from the word list, then the oval you drew stays on the grid, and the word from the word list is marked through and its color is changed. (If you've tried to select a group of letters that isn't on the word list, the oval disappears.)

graphics/cd_icon.gif

Now that you have a basic understanding of how the core of the game functions, I'll tell you about the rest of the game. Open wordsearch.swf in the Chapter14 directory.

graphics/14fig02.gif

The first thing you see is the main menu (also called the splash screen). This is the screen from which the player should be able to reach all major areas of the game. This basic splash screen has just three buttons: Start Game, Instructions, and Credits.

Where is the content for the Instructions and Credits pages?

In wordsearch.fla I have included all of the graphical assets and ActionScript needed for the complete game of Word Search. However, I have left the credits and instructions screens blank, because it will be easy enough for you to fill them in, and you can do it in your own way. Unless you take this game completely unmodified and put it on your Web site, chances are you will have made enough changes to the way things work that you should write your own instructions on how to play the game. You can easily list the instructions for this game in a text field on the instructions page. And on the credits page you can list yourself and whoever helped you create the word lists (and even me if you want to!).

When you click Start Game, you are immediately taken to a new screen. On this screen you can scroll through a roster of word lists. Each category contains 14 words that will be hidden in the Word Search grid. To select a category, click the category name and click the Play button. You are then taken to the game screen. A list of words is displayed on the left. Each of those words is hidden among the pool of letters in the grid. Unlike what happens in the paper version of this game, if you get stumped, you can click the Show Answers button. This will make all of the letters invisible except those that fall within a word from the word list.

graphics/14fig03.gif

Every time a game starts, the grid is randomly created. The words are placed randomly and the filler letters are chosen randomly. The end result is this: You can play the same word list thousands of times and never get the same grid configuration. If you click Restart, the game will be restarted with a new grid configuration, but with the same word list.

That's it for the basic tour of the game. There is one more important thing to note, though. The word lists are stored in a single XML file called wordlists.xml. To fully understand how Flash loads an XML file and parses it to extract the necessary information, see Appendix D, "XML Basics in Flash." But even without much knowledge of XML, you can still modify the word lists very easily. You can add or remove lists, or just change what is there.

Open wordlists.xml from the Chapter14 directory. (As you probably know by now, you can open an XML file in almost any text editor.) The format of the XML in this file is very basic and should be easy to understand. The root node the lowest level of the XML structure is <lists>. There can be any number of <list> nodes that are children of <lists>. Each <list> contains 14 <word> nodes (to correspond to the 14-word format we've chosen for this game). Following is an example of what the entire XML file could contain if there were only two word lists.


<lists>
        <list category="Classic Films">
                <word>casablanca</word>
                <word>africanqueen</word>
                <word>wizardofoz</word>
                <word>bodysnatchers</word>
                <word>redplanet</word>
                <word>vertigo</word>
                <word>suspicion</word>
                <word>charade</word>
                <word>musicman</word>
                <word>lifeboat</word>
                <word>showboat</word>
                <word>thinman</word>
                <word>palerider</word>
                <word>blob</word>
        </list>
        <list category="Greek Mythology">
                <word>zeus</word>
                <word>hera</word>
                <word>hermes</word>
                <word>minerva</word>
                <word>apollo</word>
                <word>artemis</word>
                <word>aphrodite</word>
                <word>poseidon</word>
                <word>hades</word>
                <word>cronos</word>
                <word>gaia</word>
                <word>ares</word>
                <word>atlas</word>
                <word>demeter</word>
        </list>
    </lists>

Other than my choices for classic films, this example file should be fairly easy to understand. You'll notice that there is an attribute called category on the <list> nodes. This is the name you will see in the scrolling list on the Start Game screen of the game. You should also note that it doesn't matter if the words are capitalized or lowercased (except in the category attribute), because in the game all of the letters are going to get capitalized. Finally, you cannot use any characters in the <word> tags that are not letters. That means no spaces, dashes, numbers, or any symbols that are outside the realm of A Z. As an example, "Wizard of Oz" is written above as wizardofoz. With this information, you can easily create your own word lists!



Macromedia Flash MX Game Design Demystified(c) The Official Guide to Creating Games with Flash
Macromedia Flash MX Game Design Demystified: The Official Guide to Creating Games with Flash -- First 1st Printing -- CD Included
ISBN: B003HP4RW2
EAN: N/A
Year: 2005
Pages: 163
Authors: Jobe Makar

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net