Game Development Reference
also the basis for understanding the right way to do keyboard control, which adds a few extra layers of
flexibility and polish to the same underlying system. If you understand how the wrong way works first,
you'll be better able to understand and appreciate the right way to do things. But don't worry, you'll
take things a step at a time, and you'll be surprised by how simple the process is when you put it all
Creating a player character
The first job is creating a player character that you can move. To make things a little easier for myself
in the game design process, I decided to try and create it with the dimensions of: 50 pixels by 50 pix-
els. This doesn't mean that the object will be completely square-shaped, but that those dimensions
will be its maximum height and width. There are some important reasons for this that I'll discuss in
detail in the next chapter, but for now, just trust me when I tell you that it will make your life as a
game designer quite a bit easier a few more stations down the line.
Make sure that the player character is positioned in the exact center of the symbol editing window.
Many of the techniques covered in this chapter require you to calculate what the half-width and half-
height of the lh]uan object is, and the numbers will be a little more consistent if the lh]uan object is
exactly centered. The following steps show you how to do this.
So let's create the player character!
1. The first job is to make a grid visible so that you can design the character in it. Select View °
Edit Grid .
2. The Grid dialog box opens, which allows you to modify the properties of the grid. Select Show
grid . (You can also select the Snap to grid option if you want Flash to help you precisely align
your shapes and objects. It's sometimes very helpful, but can also sometimes be very irritating,
so I'll leave it up to you whether you want to select it.) Figure 6-1 shows an example of what
my Grid dialog box looks like.
Figure 6-1. Make a grid visible to help you design your player object.
3. Click OK . You'll see a 50-by-50 pixel grid of squares appear on the stage. This grid is visible only
while you work and won't be visible in the published SWF file.
4. Select Insert ° New Symbol . Give it the name Player and make sure that it's a Movie Clip . Select
the Export for ActionScript option and click OK .