• 13
• 15
• 27
• 9
• 9

# problems with isometric layering...

This topic is 4782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys.. You are the experts on this subject so I'll ask you. I'm writing an ISO engine for a tactics-like game (think final fantasy tactics or tactics:ogre). My problem is how do I write a refresh program that determine what is on top of what when it refreshes. At first I thought like this: layer1 - grass layer2- units/troops layer3- first height scale layer4- first height scale units/troops .. so on but what I found is that this is flawed. I'll try to explain it but you may be confused. when the screen refreshes it puts the "height layer 1" ontop of units that are on the "grass" but their sprite goes above one tile. (ie. tiles are 32 x 64.. characters are 64 tall.. thus two tiles). It does this whenever the unit is down from the height 1 tile. How do I fix this? Please help! --Grey_Havoc

##### Share on other sites
here.. I got an image for an example. The green squares are height one (blue are water, but disregard that).

##### Share on other sites
Hehe... my project is almost exactly like yours :)
I have a multidimensional array that looks like this:
tiles[y][x]
In the array I store my Tile class that holds the information about each tile (graphics, height, passable, etc). The first thing I do is run through this list by going like this:
for (int y=0; i<MAP_HEIGHT; y++) {    for (int x=0; x<MAP_WIDTH; x++) {        tiles[y][x].drawTile();        if (tiles[y][x].hasActor()) //DO THIS FOR EACH LAYER            (tiles[y][x].getActor()).drawActor();    }}

So basically you render from back to front, but make sure you render everything at that X,Y, or you'll get the overlap.

I also set up my maps staggard, so instead of a diamond I get a rectangle, then I have staggard X,Ys. This way I can easily iterate from back to front, drawing each Y in these steps: Dirt-Blocks, Grass/other-tile, Plants/Objects, Characters. One you have done it for one Y, go and do it for the next Y. Don't render the whole layer at one time!

[Edited by - H_o_p_s on February 12, 2005 12:47:17 AM]