![]() |
|
Multilevel map for 2D game. |
Donald_W
Member #7,982
November 2006
|
Hello! I was wondering about best way to implement multileveled map for 2D game: Each tile should be implemented like: Or any other, more optimized ways to do that (in fact such implementation will consume a lot of memory!) ~Donald_W |
Jonatan Hedborg
Member #4,886
July 2004
![]() |
Each "location" could have a List or a Vector of "tiles" (or, if you are using plain C, a pointer to a dynamically allocated, zero-terminated array)
|
Neil Walker
Member #210
April 2000
![]() |
Maybe just creat multiple layers the same way as you're creating a single layer. To access each layer is then just a matter of setting a pointer to the level you want to work on and repeating your drawing code. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Neil Black
Member #7,867
October 2006
![]() |
just draw each level, from lowest to highest, up to the one the player is currently on. For more spped (and more math) start from the highest and only fill in the spaces that are visible on the lower levels. I've never actually done this, but it seems sensible. if it's not, I'm sure someone will make sure to scream at me exactly why I'm wrong.
|
vbovio
Member #8,283
January 2007
|
there are many ways to implement a 2D map, if this is the first time you do it, my advice is to go for the simplest solution, also consider how are you going to do those maps/levels, a tool like mappy or tile studio will help. --------------- |
Kikaru
Member #7,616
August 2006
![]() |
Just use a 3D array. Or, if you feel up to it, use a 2D array of long ints, then use bit-shifting and bit-masking to access the individual bytes. This is a lot like using a 3D array of char values though, so that would be better. |
|