Isometric algorithm producing tiles in wrong draw order
- by David
I've been toying with isometric and I just cant get the tiles to be in the right order.
I'm probably missing something obvious and I just can't see it.
Even at the risk of looking stupid, here's my code:
for (int i = 0; i < Tile.MapSize; i++)
{
for (int j = 0; j < Tile.MapSize; j++)
{
spriteBatch.Draw(
Tile.TileSetTexture, new Rectangle(
(-j * Tile.TileWidth / 2) + (i * Tile.TileWidth / 2),
(i * (Tile.TileHeight - 9) / 2) - (-j * (Tile.TileHeight - 9) / 2),
Tile.TileWidth, Tile.TileHeight),
Tile.GetSourceRectangle(tileID),
Color.White,
0.0f,
new Vector2(-350, -60),
SpriteEffects.None,
1.0f);
}
}
And here's what I end up with:
messed up map
Yep, bit of an issue. If anyone could help, I'd appreciate it.