[help] thin isometric walls
A Flash Developer Resource Site

# Thread: [help] thin isometric walls

1. ## [help] thin isometric walls

I've been stuck with a depth sorting issue for a long while now, and that's for thin partition walls that the hero can walk either side of. Using a depth sorting algorithm that takes a greater account of the y position of the sprites causes the following error:

(the blue crosses show where the clips are centred.)
No matter how I arrange the centre of the clips, I can't see a way to ensure that the hero can move around the thin wall and both be depth sorted correctly.
Any ideas?

2. Simple sorting based on y-position works very well under simple conditions, like all the walls always occupy one full tile. Not 2 or more tiles. Not half tile. Such uncommon situations need more advanced sorting.

For example you could store the wall as line vector with starting point and length. The position of hero would be a point. Now you can easily find which side of the line the point is. Until the hero remains right hand side of the wall, it would be visible (depth above the wall). Once the hero goes left hand side of the wall, the wall would block the hero (hero goes behind the wall). I am sure this would give correct result, only it would need more complex calculations and so for large number of walls could be possibly too slow.

3. I've never done isometrics, but if your walls are only going to be on the sides of the tile, I think you can use a set order per tile. The two walls in front go in front(south-west and south-east), then anything on the tile and then the two walls in the back (north-west and north-east). If you loop through your visible tiles in order than you should have everything sorted.

4. Tony's method will work very nicely, if you only check tiles that overlap the hero and then the geometry within them you can cut down lots of calculations.

Another simple option might be sorting based on isometric coordinates, not screen coordinates. In iso coords the yellow box is infront of the red rectangle, but screen coordinates its behind.

I'm sure you know how to convert from screen to iso.

5. ah - thanks, Mr Malee, I'd not considered doing that. That's definitely worth trying

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap