Multiple layer maps

Started by
2 comments, last by Evol970 21 years, 4 months ago
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 ?)
Advertisement

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
New Dog Adventures waits you!
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;  


[size="2"]I like the Walrus best.
thx a lot guys it''ll help a lot

This topic is closed to new replies.

Advertisement