Zorder (moving behind and in front of the same object)

Get help using Construct 2

Post » Tue Oct 14, 2014 10:41 am

I'm trying to get the player (8Direction) to move behind and in front of some objects. With this example it works only with the tree but not with the other two objects.
pic: https://dl.dropboxusercontent.com/u/98471899/Scirra/zorder.png
Capx: https://dl.dropboxusercontent.com/u/98471899/Scirra/zOrderTest.capx
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

Post » Tue Oct 14, 2014 11:35 am

........ Y........
You do not have the required permissions to view the files attached to this post.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Oct 14, 2014 11:40 am

It's because it is testing all of those conditions every tick and so only paying attention to the last two. The tree works because it is the last in the list - Change the order of the events so that the events testing for the house are last and it will work for the house and not the tree. Perhaps if you changed your conditions to an 'on collision' test? Maybe that would work?
B
7
S
1
Posts: 16
Reputation: 711

Post » Tue Oct 14, 2014 12:13 pm

korbaach wrote:........ Y........


Oops, a little mistake when I threw together this example... Still the same problem though.
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

Post » Tue Oct 14, 2014 12:22 pm

jillhoff wrote:It's because it is testing all of those conditions every tick and so only paying attention to the last two. The tree works because it is the last in the list - Change the order of the events so that the events testing for the house are last and it will work for the house and not the tree. Perhaps if you changed your conditions to an 'on collision' test? Maybe that would work?


Thanks for the help.
I redid it here and it seems to work OK now (but needs a bit polish).
https://dl.dropboxusercontent.com/u/98471899/Scirra/zOrderTest2.capx
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

Post » Tue Oct 14, 2014 1:16 pm

If you can but them all in to family like ZOrder for instance and run loop for each ZOrder order by ZOrder.Y ascending and move to top of layer. Also move the origin point to lower part of the Sprites. If you have a lot of objects take into account only objects that are on the screen and maybe you don't necessarily need to sort them every tick.
B
34
S
9
G
3
Posts: 517
Reputation: 5,246


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests