-
Isometric z-soring by coordinates, not x/y
Greetings, I have an isometric game and wish to do a zsoring based on i,j and sizeI and sizeJ of the "buildings". There is no Z axis in the game.
If there is anyone that is using this, you could copy paste your sort() function and I will adapt it.
So far this gives me limited success:
private function sortingFunction( a:IRenderable, b:IRenderable ):int
{
if( a.top > b.bottom && a.left > b.right ){trace( "> , >" ); return 1; }
if( a.top > b.bottom && a.left < b.right ){trace( "> , <" ); return -1; }
if( a.top > b.bottom && a.left == b.right ){trace( "> , =" ); return 1; }
if( a.top < b.bottom && a.left > b.right ){trace( "< , >" ); return 1; }
if( a.top < b.bottom && a.left < b.right ){trace( "< , <" ); return -1; }
if( a.top < b.bottom && a.left == b.right ){trace( "< , =" ); return -1; }
if( a.top == b.bottom && a.left > b.right ){trace( "= , >" ); return 1; }
if( a.top == b.bottom && a.left < b.right ){trace( "= , <" ); return -1; }
return 0;
}
I think you can understand all of this code.
Thanx!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|