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

Get help using Construct 2

Post » Tue Jun 17, 2014 11:37 pm

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.

Image

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
Last edited by monitz87 on Wed Jun 18, 2014 4:22 am, edited 1 time in total.
B
6
S
2
Posts: 79
Reputation: 608

Post » Tue Jun 17, 2014 11:39 pm

I forgot to mention that I'd rather not use hitboxes if possible, it should be a purely position-based algorithm
B
6
S
2
Posts: 79
Reputation: 608

Post » Wed Jun 18, 2014 3:01 am

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:
Image
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.
B
35
S
9
G
4
Posts: 201
Reputation: 5,170

Post » Wed Jun 18, 2014 3:28 am

Ahr Ech wrote: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:
Image
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.
B
6
S
2
Posts: 79
Reputation: 608

Post » Wed Jun 18, 2014 4:07 am

YES!! IT WORKS!!!

THANK YOU <3
B
6
S
2
Posts: 79
Reputation: 608


Return to How do I....?

Who is online

Users browsing this forum: MassimoF and 29 guests