I want to compare 2 object position on layer (higher/lower) both for the same layer or different ones. Is there a way? Thanks!
Develop games in your browser. Powerful, performant & highly capable.
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.
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!
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.
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