How do I Bring bring highest y-value object(same) to front

0 favourites
  • 3 posts
From the Asset Store
50 front view of buildings JPG - residences shops and offices - 2048x2048
  • I have a bunch of icicles fall from the screen and land in the ground. sometimes they will overlap each other. I am having trouble with a compare statement to check which icicles are "lower on the screen" or have a higher y-value and then bring them to the front of the layer.


    Does this have to do with uid's and iid's? i was reading about this a bit but couldn't figure it out.

    Any help will be appreciated thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The problem with what you're doing is that you're essentially comparing each icicle's Y position to itself, rather than to the other icicles. Instead, I'd recommend running For Each (ordered) on your icicle object, setting the expression to the icicle Y position, and running in ascending order, then run your move to top action. This should loop through each of your icicles from top to bottom, sending each subsequent one to the top until they're all in proper order.

  • [attachment=0:3q5pb4h1][/attachment:3q5pb4h1]

    Solved thanks works perfectly. Made my day!

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