Automatically Setting Z Index

0 favourites
  • 3 posts
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put everything you want sorted in a family and set it up in a For Each (Ordered) condition like this:

  • Alrighty, that did the trick! Thank you very kindly.

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