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

Get help using Construct 2

### » Thu May 25, 2017 3:37 pm

There is an action for objects to move them to a desired layer.

From what I read .. you need that.

You can use compare 2 vars from system to check different objects their layer.
Who dares wins
B
57
S
17
G
21
Posts: 1,880
Reputation: 19,628

### » Thu May 25, 2017 3:45 pm

Give the family another instance variable Type. Give each type, triangle square etc a specific number for type. 1 for triangle 2 for square etc.

For each level you need to define a win condition.
Eg if object with iv type 1 has iv z 2 and object iv type 2 has iv z 1 then win.

I would do this with an array. Eg define each win condition for each level in an array. Use 3d array use array z for each level. Xy for the win conditions.

Note layers way might also work in place of z instance variable but you will still have to define your win conditions in an array tho, assuming you will have a few levels. I can't think of another way unless you want tons of variables flying around.

The issue using layers is that you will have to have as many layers as the max number of objects. if small number maybe less than 10 then OK. But If u use z iv then u can have as many objects as u like and keep adding without worry to make very big puzzle for pro skillz gamers....

Actually to avoid arrays, which can be confusing for inexperienced, then you could probably add another instance variable to the family for winz and if all winz = z then win....
NOTE: There is a high a probability that I am wrong.
B
52
S
27
G
7
Posts: 461
Reputation: 8,964

### » Thu May 25, 2017 4:12 pm

NetOne, could you make simple example with that array 3D? It's possible in C2?
I was afraid, that this will be impossible to make in C2 ... but i want to make prototype with 10-15 levels. Eventually i want to make that game in Unity / C#, but for now im newbie in programming.. and i have no skills yet.. so i wanted to make simply prototype of my game to check if its worth making that for commercial in Unity and learning C#.
But if there is no way to check that, i will make the prototype without checking right Z order.
You;re right.. in C2 i had to do that with a tons of variables and condition to each objects in each levels.. So 10- 15 levels is maybe possible, but 70 ? ..
B
4
Posts: 34
Reputation: 268

### » Thu May 25, 2017 4:40 pm

Yes you can easily do this with C2. But sorry man , the only reason I can post on this forum is that I am at work and just keep the forum open while I do my real job work tasks.
I can’t do any actual C2/C3 work at work.
Once I leave work it is all kids and wife stuff.
I can only use C2 on the weekends late at night.

Maybe someone else will pitch in with an example
but actually I don’t recommend looking at other projects if you want to seriously be a game dev and learn and be autonomous.

The way I would work is to try different things and divide my learning into small mini projects eg,
Learn to use family with IVs
Learn to use z sorting with IVs or layers.
Learn to use arrays / dictionaries
Learn to compare variables and set win conditions.

after a while with C2 (and same with unity and programing)
you will realise that there is 10 different ways to achieve the same thing.

and if you know the 10 different ways then you can decide yourself the best way for your unique game without listening to ideas from people who don’t really understand your vision.
NOTE: There is a high a probability that I am wrong.
B
52
S
27
G
7
Posts: 461
Reputation: 8,964

### » Thu May 25, 2017 4:55 pm

Ok, no problem I will learn about arrays 3d, read about that and try to do that by myself.
I just thought, there is simply way to do that using conditions like "Triangle is in front of/behind Square" but its not..
B
4
Posts: 34
Reputation: 268

### » Thu May 25, 2017 6:23 pm

to make this a little bit simpler, maybe avoid the z order? i generally only use z order to enforce a foreground and background, and to save myself from using a second layout/layer for a main menu screen. however, you can do something along the lines of (add event)"If A is overlapping B" (add condition) "If B is overlapping C" (add action) Go To Layout
B
28
S
14
G
1
Posts: 148
Reputation: 3,218

### » Thu May 25, 2017 6:25 pm

also, if you need them to be more than just overlapping but overlapping in aspecific spot, put an invisible box named D etc
B
28
S
14
G
1
Posts: 148
Reputation: 3,218

### » Thu May 25, 2017 6:34 pm

I tried that what u're writting... but there is no difference if object A is overlapping object B , or object B overlapping object A.. :/ I thought it make difference but it doesn't.. So i think there is no simply way to do that..
B
4
Posts: 34
Reputation: 268

### » Thu May 25, 2017 7:09 pm

i have an answer for you but i do not have time to type it out atm, however, if youre still on in an hour or so ill answer this
B
28
S
14
G
1
Posts: 148
Reputation: 3,218

### » Thu May 25, 2017 7:35 pm

Sure, its still actual Im just making other things It will be great!
B
4
Posts: 34
Reputation: 268

PreviousNext

Return to How do I....?

### Who is online

Users browsing this forum: Proxymity and 6 guests