Game Development Reference
In-Depth Information
int widths[] = {2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4};
int heights[] =
{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,3,3,3,3,3,3,4};
The preceding lines specify the widths and heights of each new building. These will be
multiplied with the tile size determined for our game to get the final width and height val-
ues as you saw in
Block:setupBlock
.
We'll use a
0
value for height to mean there is no change in height from the previous
building. A similar logic could be easily applied to widths.
And finally:
int types[] =
{1,2,3,4,1,3,2,4,3,2,1,4,2,3,1,4,2,3,1,2,3,2,3,4,1,2,4,3,1,3,1,4,2,4,2,1,2,3};
These are building types and this array will not be shuffled unlike the three previous ones,
so this is the
patterns
array of
types
we'll use throughout the game and it will loop
continuously. You can make it as long as you wish.