A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [help] thin isometric walls

  1. #1
    curiouser and curiouser LittleRed's Avatar
    Join Date
    Mar 2004
    Location
    Nottingham
    Posts
    335

    [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. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    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. #3
    Funkalicious TOdorus's Avatar
    Join Date
    Nov 2006
    Location
    Nijmegen, Netherlands
    Posts
    697
    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. #4
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    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.
    lather yourself up with soap - soap arcade

  5. #5
    curiouser and curiouser LittleRed's Avatar
    Join Date
    Mar 2004
    Location
    Nottingham
    Posts
    335
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center