How do I compare layer position?

Get help using Construct 2

Post » Fri Jun 05, 2015 10:02 am

I want to compare 2 object position on layer (higher/lower) both for the same layer or different ones. Is there a way? Thanks!
B
66
S
22
G
4
Posts: 360
Reputation: 6,584

Post » Fri Jun 05, 2015 10:23 am

Well for each object you have the functions "Is on layer" and "Pick top/bottom".
If you know that layer A is higher than layer B you can compare the position based on that. But I don't know if this will help on what you want to do.
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Fri Jun 05, 2015 10:25 am

So Pick top/bottom also cpmpares between 2 objects position on the same layer, doesn't it only pick the top/bottom object of a layer? In that case, it solves the problem for me!
B
66
S
22
G
4
Posts: 360
Reputation: 6,584

Post » Fri Jun 05, 2015 10:27 am

Actually, it doesnt, i have 2 object: leaf and stone. I want leaf to do not move if stone is, within the same layer, higher than leaf, so i need a way to compare that.
B
66
S
22
G
4
Posts: 360
Reputation: 6,584

Post » Fri Jun 05, 2015 10:03 pm

You might have to assign an instance variable on leaf and stone and track it manually.

Something like:

instance variable zLayer (Number)
0 through [whatever]

Then assign the zLayer var manually, and do a check:

leaf.zLayer >? stone.zLayer
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 12 guests