Game Development Reference
In-Depth Information
4.2 Maps
All maps are implemented with a class named GameData , which encapsulates a 4D array of
map data, each layer consists of a 10 x 7 matrix. For instance, fill the following data in the
array of stage 3:
//10x7 matrix, 0-null,1-road,2-stake,3-4-5-bonus
{ //stage 3
{ //lower layer
{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,0,0},
{0,0,0,0,0,0,0}},
{ //upper layer
{0,0,0,0,0,0,0},
{0,4,4,4,4,5,0},
{0,0,0,0,0,4,0},
{0,0,0,0,0,3,0},
{0,4,4,4,4,4,0},
{0,0,0,0,0,4,0},
{0,0,0,0,0,3,0},
{0,5,4,4,4,4,0},
{0,0,0,0,0,0,0},
{0,0,0,0,0,0,0}}
}
The map layout of stage 3 should be like this (figure 4.2):
Search WWH ::




Custom Search