I’m going to build an advanced 2D Up-Down RPG.
It’ll be a C# + XNA version of my existing 2D Flash RPG Engine ( Adobe Air ).
Well, in Flash Pro i’ve simply used different MovieClips for the different Layers but how could i realize that in C# using XNA ?
I want to be able to use the output ( map-data-file ) from the Flash Map Editor I’ve made.
The Output file looks like this:
<layer1>
0.0.0.A.A.A.A.B.B.A.A.0.0.0
0.0.0.A.A.A.A.B.B.B.A.A.0.0
0.0.A.A.A.B.B.B.B.B.B.A.0.0
0.A.A.A.A.B.B.B.B.B.B.A.A.0
0.A.A.A.A.B.B.B.B.B.B.A.A.0
0.A.A.A.A.A.B.B.B.B.B:B.A.0
0.0.A.A.A.A.B.B.B.B.A.A.A.0
0.0.A.A.A.A.A.B.B.A.A.A.0.0
0.0.0.A.A.A.A.B.B.A.A.0.0.0
<layer2>
. . . . .
. . .
.
.
<layer3>
.
.
.
an so on…
where:
0 = Blank;
A = Gras;
B = Water;
so i want to simply loop through these lines, save in arrays and add the coresponding sprites to the specific layer, maybe like this:
Layers[2].Add( tile, x, y );
how can i realize that ? and also, how can I manage the z-sorting, cuz further i want to be able to walk under bridges, or drive through tunnels.
( like in this image, there could be a ship driving unter the bridge )

or even some stairs to get to the next stage ( switch layer )
do you guys have any idea or even a refference for me ?
thx for all your answers !
EDIT:
the layer hirachy shoult look like this :
map{
Layer[0] { // "bg"
xyArray{ .... }
}
Layer[1] { // "static" - bottom part / stairs of the bridge
xyArray{ .... }
}
Layer[2] { // "items"
xyArray{ .... }
}
Layer[3] { // "player"
xyArray{ .... }
}
Layer[4] { // "static2" - top part of bridge
xyArray{ .... }
}
}
// if the player is ON a tile that hat a Stair funktion, the "player" layer will be
// moved on top of the "static2" layer, so 'Layer[3].Z = 4;' and 'Layer[4].Z = 3;'
// like i showed in the Switch funktion up there
The
SpriteBatch.Drawmethod has overloads that let you specify LayerSpecifically, the bottom two entries on the table here
The layer is a float between 0 and 1. You’ll also need to specify a
SpriteSortModein yourSpriteBatch.Begin(). Below is an example from a board game I wrote that tints the player tokens and moves the active player to the very front of the stack for when multiple players occupy the same square:Hope this helps.