Thank you for visiting Blazing Games

Fluid Dynamics

Having the map is nice, but actually making the map work the way we desire is a bit of work. First of all, we need a movie clip to hold the tiles used in the game. As we are using a movie clip, having the tiles be animated is very little work. Essentially, all the tile movie does is hold a number indicating the type of tile that we are using and play the looping animation sequence that is associated with that tile. The tiles are created dynamically in a separate movie clip. A separate clip is used so that we do not have to track the depth values within the main movie. As movie clips have their own separate depth levels, we can then simplify the rest of the game by having the 768 movies that make up the map in their own separate movie clip that simply acts like a single layer. This layer has a function for creating a the game map (shown below) and ones that allow the parent to set the value of the tiles which are too simple to bother listing.

Once the game map has been created, the main game has to populate the map with the proper tile values. As the tile map is stored within the program as a simple array of strings, the characters within the string are converted into actual numeric values. While this is far from the most efficient way of setting up the map, it only has to be done once so we don't have to be too concerned with efficiency. Here is the code that sets the tiles within the map layer to their proper map values.

With the map on the screen, we now only have to worry about implementing the player movement through the map. The player is a special case of a movie clip that has four buttons attached to it in each of the four directions that the player can head. Clicking on a direction sets a movement direction in motion. Each frame the program looks at the player's current movement direction state and if the player is moving, adjusts the player's position on the screen changing the movement direction to that of the tile that the player has entered.

Previous page
Chapter 11 Page 4

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2006 Blazing Games Inc. All Rights Reserved