[SOLVED] Handling z-order in 3/4 perspective with a twist

0 favourites
  • 5 posts
From the Asset Store
Easy Isometric
$18 USD
10% off
EasyIsometric behavior helps creating an “isometric” perspective with 2D assets.
  • Hi everyone,

    I'm currently building a 3/4 perspective board game, and so far I'm having a LOT of trouble with the z-order. Normally it would be a breeze, but I've got a certain element of uncertainty in the game.

    As you can see, I've got these screens which make bullets bounce, and depending on where the bullet is coming from, the bullet should be either in front or behind the screen when they share a tile. I've tried a million different approaches to the z-ordering but every time there's a certain case where it doesn't work as intended.

    Does anyone know of a reliable algorithm to sort my sprites in the Z layer? As you can see, it's not a thing of just moving things with the highest Y to the top of the layer.

    Cheers

  • I forgot to mention that I'd rather not use hitboxes if possible, it should be a purely position-based algorithm

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The usual method for isometric or 3/4 view Z-sorting in C2 is to add everything you want sorted to a family and set up an event like this:

    For additional control, I like to add an instance variable to the family called elevation, and sort by IsoObject.Y+IsoObject.Elevation. That way I can change an object's sorting priority without changing it's position. Hopefully you can adapt that to suit your needs.

  • The usual method for isometric or 3/4 view Z-sorting in C2 is to add everything you want sorted to a family and set up an event like this:

    For additional control, I like to add an instance variable to the family called elevation, and sort by IsoObject.Y+IsoObject.Elevation. That way I can change an object's sorting priority without changing it's position. Hopefully you can adapt that to suit your needs.

    Thanks, I'll try doing that. I'll calculate the Elevation prior to the sorting by using the X positions of the bullets relative to the Screens on the same tile. I'll tell you if it works out.

  • YES!! IT WORKS!!!

    THANK YOU <3

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)