relative z-order?

Get help using Construct 2

Post » Sun Mar 02, 2014 9:04 pm

I'm working on a project with a birds eye view kind of like (Fallout 2 image) and need some help with z-order.

Image

For example: When I place a tree in the layout I want the players index to be higher when he's in front of the tree. The head of the player sprite should cover the tree. But if he's moving behind it the top of the tree sprite should cover the player when walking behind it, meaning that the the z-order of the tree should have changed. Collision boxes are already set to a small square at the base of both the tree and the player sprite, but I cant get the player to be both behind and in front of the tree.

So what I'm looking for is a way to set the z-order of the tree relative to the player position, or according to the grid or something like that. Is that possible and how could it be done? I'm planning to have a lot of these kind of objects, where the player can walk behind them, and the player can also cover them.

Any help appreciated.
Follow my progress on Twitter
or in this thread Archer Devlog
B
41
S
18
G
18
Posts: 1,024
Reputation: 13,345

Post » Sun Mar 02, 2014 9:26 pm

x goes from left to right.
y goes from up to down.
Knowing that you can guess that if the players y is greater than the trees, then the player is in front of it.
Image ImageImage
B
170
S
50
G
179
Posts: 8,378
Reputation: 113,425

Post » Sun Mar 02, 2014 10:09 pm

Well that much I can figure out myself, but how do I go about doing it? Using some function or what? And what would be the best way to do it since a LOT of objects needs the same kind of instructions.
Follow my progress on Twitter
or in this thread Archer Devlog
B
41
S
18
G
18
Posts: 1,024
Reputation: 13,345

Post » Sun Mar 02, 2014 10:12 pm

There are dozens of ready to go examples here on forum explaining how you can do this. Use search and you will get what you want.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests