Sign in to follow this  

problems with isometric layering...

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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!



If you have any more questions, please ask!

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

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this