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

Get help using Construct 2

Post » Thu Jan 29, 2015 9:58 pm

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.

icicleproblem.png


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.
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234

Post » Thu Jan 29, 2015 10:16 pm

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.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,126

Post » Thu Jan 29, 2015 10:40 pm

iciclesloved.png


Solved thanks works perfectly. Made my day!
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests