Game Development Reference
In-Depth Information
5.
Next, it will ask you how much to adjust the map values. This is an important question
because Mappy added that extra blank tile to the beginning of our tile sheet. Because
of this, the actual map values are 1 greater than they will be when we use the original
tiles.png file as our source for times in Flash. For that reason, put a -1 into this dialog
box, and click the OK button.
The ActionScript exported for this sprite map will look something like the following code. Notice
that 0 has been exported in each location where we had a blank space on the sprite layer. When
we code the sprite placement routine in the next chapter, we will need to ignore any tiles in the
map that have an id of 0 .
var map = [
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,9,0,0,20,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,9,0,9,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,9,0,23,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
]]
Setting up our project
As with all of the games in this topic, No Tanks! will use the framework package structure we
created in Chapter 2. Let's begin by creating the package necessary for our game in both the
Flash IDE and Flash Develop (for use with the Flex SDK).
Creating the No Tanks! game project in the Flash IDE
Here are the steps needed to create the game in the Flash IDE:
1.
Start up your version of Flash. I am using CS3, but this process should work exactly
the same in CS4 and CS5.
2. Create a .fla file in the /source/projects/notanks/flashIDE/ folder called notanks .
3. In the /source/projects/notanks/flashIDE/ folder, create the package structure for
your game: /com/efg/games/notanks/ .
4.
Set the frame rate of the Flash movie to 30 FPS. Set the width to 640 and the height
to 500.
5.
Set the document class to com.efg.games.notanks.Main .
Search WWH ::




Custom Search