How do I change z-order depending on position

Get help using Construct 2

Post » Fri Jan 16, 2015 12:08 am

I have a bunch of enemys running around on a sidescroller with a little depth. So enemys can have higher or lower y-value than the other. But sometimes the enemy with higher y-value appears to be below another enemy with a lower y-value. How do I fix that? Since the enemys are the same object i can not campare self.y to enemy.y. Thanks in advance
B
11
S
4
G
2
Posts: 116
Reputation: 1,936

Post » Fri Jan 16, 2015 1:45 am

Run a For Each (ordered) loop sorted by the expression enemy.y, order ascending, then add an action to send the current enemy to the front. That will order all of your enemies properly relative to each other, then it's just a matter of properly ordering your other objects among them.
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,106

Post » Fri Jan 16, 2015 8:13 am

Oh, that sounds like it's going to work. Thanks @linkman2004 I'm gonna try that when i get home.
B
11
S
4
G
2
Posts: 116
Reputation: 1,936


Return to How do I....?

Who is online

Users browsing this forum: MadSpy and 3 guests