Archived

This topic is now archived and is closed to further replies.

Evol970

Multiple layer maps

Recommended Posts

Hi, I bought the book Programming role playing game with DirectX and I got a question about maps with multiple layer. I read in that book that a good way to do thing when creating a tile-base game is to make multiple layer map...1 layer for the map, another one for sprite(ex: trees) and another one for moving objects(ex: player). A normal map look like this 0 0 0 0 1 0 0 0 0 where each number represent a different tile. I understand that and made a map builder. My question is how to put a sprite on that map and save it to the file ?? ex: if a tree got the number 3 and the grass number 1 how can I save this to the file if the tree is on another layer. Two map file ?(one file for each layer ?)

Share this post


Link to post
Share on other sites

If you make map file for each layer, you have veery much empty, memory taking space there If you get what I mean.

Well personally what I use to making map is following:

You have one map file with
0,0,0,1,0,0
0,1,1,1,0,0
1,1,1,1,0,0

etc where one number represent different tile ex water, grass and so on..

Then you have a items file where you have:
Item 01
{
Attributes etc
x-tile 4
y-tile 4
alt 0
}
Item 02
{
Attributes etc
x-tile 4
y-tile 4
alt 25
}
etc
when rendering map when you render each tile you check if there is item on that tile from items file and so on and so on.

Rkasvi

Share this post


Link to post
Share on other sites
I''m doing this:

  
typedef struct stLayer
{
unsigned char bVisible; // Layer is visible

int NumSprites; // Number of sprites on this layer

RECT rcLayer; // Visible area of the map

CSprite* pFirstSprite;
CSprite* pLastSprite;
} LAYER;

typedef struct stLayers
{
int iNumLayers;
LAYER* pLayer;
} LAYERS;


Share this post


Link to post
Share on other sites