Game Development Reference
In-Depth Information
center that is placed at 0,0. We don't want that. For our map marker, we will also use an Upper Left origin, but it will
be positioned with the use of variables. Last, you can set Blending options. The lower the opacity of your picture, the
more translucent it will appear. You can have additive or subtractive types of blending as well, which influence how
the picture's colors look.
Creating Our Town Map Common Events
This is where it gets interesting. The general idea for our common events is the following:
When the player uses the Map item, we want to determine the player's x and y coordinates.
After that, we apply a multiplier to the X and Y variables.
Afterward, we use a pair of Show Picture commands to display the map and the map marker.
What multiplier do we need? We have to correlate the pixel size of the map picture (546 × 417) with the tile size in
the map editor (39 × 48). This is as easy as dividing the first value by the second for both X and Y. The multiplier for X is
(546/39 = 14) and the multiplier for Y is (417/48 = 8.6875), which I rounded to two digits in the following code. Here's
the first common event:
@>Control Switches: [0039:TurnOffMap] = ON
@>Control Variables: [0002:X] = Player's Map X
@>Control Variables: [0003:Y] = Player's Map Y
@>Control Variables: [0002:X] *= 14
@>Control Variables: [0003:Y] *= 8.69
@>Show Picture: 1, 'automap', Upper Left (0,0), (100%,100%), 255, Normal
@>Show Picture: 2, 'x', Upper Left (Variable [0002][0003]), (50%,50%), 255, Normal
@>
You can use the script option in Control Variables to write in decimal numbers. if you use the Constant option,
decimals will be truncated.
Note
I used a 50% zoom for the map marker, as, when displayed, 30 × 30 looks clunky on the map. As it stands, you can
create a suitable item to hold the Map common event and then start up the game. However, you'll find that using the
Map event will cause the screen to display the area map and map marker without a way to remove the pictures. That
is what the TurnOffMap switch is for. When the switch is on, the second common event is processed. I give it a Parallel
Process trigger, so that it is running concurrently until needed. The only role that the second common event has is to
erase the pictures that have been created and flip off the TurnOffMap switch until it is needed once again.
@>Conditional Branch: The X Button is Being Pressed
@>Erase Picture: 1
@>Erase Picture: 2
@>Control Switches: [0039:TurnOffMap] = OFF
@>
: Branch End
@>
Reminder
The X button maps to the a key on your keyboard.
 
 
Search WWH ::




Custom Search