How to manipulate objects in Z order ? Which is on top?

Get help using Construct 2

Post » Thu May 25, 2017 1:47 pm

Hi!

Is there any way to check (making condition) which object is on the top in z order, and which at bottom?
Im making a prototype of game, where the order is the main feature, and its important to solve pieces in right order (Z order) so how to make condition, that will check, which object is over another object (in front of) ?
B
4
Posts: 34
Reputation: 268

Post » Thu May 25, 2017 2:07 pm

Perhaps use layers ?

And use the layer reference numbers.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Thu May 25, 2017 2:07 pm

You can find object z-position using condition in the event system. Select the object you want to check and scroll all the way down under the z-order conditions, there is one called pick bottom/top.

Image
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Thu May 25, 2017 2:22 pm

Okej. But how can i make condition like:
When object A is over Object B, and Object B is over Object C - Go to next layout (complete level or something like that). How can i check / detect the order of objects, to complete level or not?

Ordering by the layers? Hm.. so, when i want to make that order: Object A = 1 (on the bottom), Object B=2 (over object A) and Object C=3 (its on the top, covering A and B). And the actions are: when im click on the object A -> Object A move to the top (I can change that to: move to layer X [by the way, there is no action like 'go to next/upper layer] but than, all the objects will go to the top layer, so how to detect the order then?

In the layout, there is an order, to sort objects in Z (i know its a fake Z, because of 2D) so the system knows, about the order.. So it should be a way, to controlling that in event sheet ;) veryfing etc..
B
4
Posts: 34
Reputation: 268

Post » Thu May 25, 2017 2:36 pm

Why do you need to check the Z order in order to which to another layout? You can just place invisible object or teleport it to player location when lvl is suppose to end, and use on collision condition to progress to next lvl.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Thu May 25, 2017 2:48 pm

Because i have an idea for my game, where the objects overlaps on themselves like in origami, and the Z order is the main feature :) its puzzle game.. so the veryfing Z order is the only way to decide if level is complete and you can go to next or not.
B
4
Posts: 34
Reputation: 268

Post » Thu May 25, 2017 2:53 pm

I see. Well you can place each object on different layer, and check the layer number, so if the wining object is at layer one then go to next level(or something similar to that, I do not know how you planed your vents).

Or you can use the pick top/bottom condition to check if the object is on top of z layer, and if is trigger the wining condition.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Thu May 25, 2017 3:07 pm

Put all the objects that need z in a family.

Then give this family a family instance variable called z. Then each object in that family will have an instance variable z. You can then use that z for everything like setting z of object or getting z of object etc. Basically you are giving the object a 3Rd dimension.

I am doing exactly this here for the rings and space invader sprites ... every tick I am sorting the objects according to their z instance variable by using for each ascending by instance variable z.

https://drive.google.com/open?id=0B6AQ9 ... WNIMmlpMEE
...
B
45
S
23
G
7
Posts: 291
Reputation: 8,020

Post » Thu May 25, 2017 3:17 pm

With layers manipulating - it will not work as i want.. because the game is based on changing the Z order in the objects by clicking on them or moving. When I move the object A in direction to object B, and it overlap / cover object B, than I can move object A back, and than move object B on the object A, so then object B will overlap / cover (will be i front of object A).

I tried that condition with 'pick top/bottom' like: object A - pick TOP instance > go to next layout. There is no option/condition like " If object A is on the "top" , or in front of object X > go to next layout :( ... or maybe you know the way to do that?
B
4
Posts: 34
Reputation: 268

Post » Thu May 25, 2017 3:27 pm

NetOne, family with Z instance is interesting idea, but how can I check which object is upper, and which is below in that Z order? For example. I have 3 objects; triangle, square and circle. At the start of the layout, the circle is behind square, and square is behind triangle. So the triangle is on the top, square is below the triangle and circle is on the bottom at z order. Now, i can changing their position in Z order by clicking on them (for example with condition like; when click on object > object move on the top). And that works fine - I can manipulating, which object is upper, and which is below..
But to complete level, i have to set objects in that order: Circle on the top, triangle is below the circle and the square is on the bottom of them. How to check that order in conditions, to make the level complete?
B
4
Posts: 34
Reputation: 268

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 30 guests