Automatically Setting Z Index

Get help using Construct 2

Post » Thu Jan 28, 2016 4:22 am

For a project I'm working on, I want to set the Z Index relative to an objects Y position on screen. As an example, Object A is at (52,127), I want to essentially have an action run every tick to set this objects Z Index to 127. The effect I'd like to achieve with this is so that when say Object B is overlapping Object A but at a lower Y value, I want it to appear to be "further back" than Object A. In other words, I'm trying to achieve an illusion of Depth. Right now as a temporary workaround, I have a few of my objects set their Z Index relative to each other object with a command running every tick to compare two objects Y Values. This of course is very tedious and rather time consuming, and in fact a bit messy as I have a number of different objects that need to have their Z Index update constantly and I think it would just be easier to set their Z Index relative to their position on screen.

It's probably worth noting that I'm a bit of a scrub when it comes to this kind of stuff so if there's a much easier way to do this, please let me know, otherwise any assistance is greatly appreciated.
B
3
Posts: 2
Reputation: 179

Post » Thu Jan 28, 2016 4:44 am

Put everything you want sorted in a family and set it up in a For Each (Ordered) condition like this: Image
B
35
S
9
G
4
Posts: 201
Reputation: 5,172

Post » Thu Jan 28, 2016 6:16 am

Alrighty, that did the trick! Thank you very kindly.
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests