I'm making a game in a top-down perspective (like A Link to the Past for example). And want to know if there is a simple way to code objects to dynamically layer themselves according to whether they are in-front or behind the player.
Currently I've said:
>>If Y("Player") > Y("Rock") then Order "Rock" behind "Player" and
>>If Y("Player") < Y("Rock") then Order "Rock" in front of "Player".
This works flawlessly... if there is only 1 instance of the Rock object in the level (and I think it works too if the height of the rocks aren't in the same Y-Zone of any of the other rocks in the scene).
The problem is, if these Y-Zone conditions aren't met, the code will work fine with ONE of the rocks, but not for any of the others (in the case of the screenshot below it works with the left-most rock).
Does anyone know a way around this? Much appreciated.
Sorry about the on-screen keyboard in the screenshot - my iMac keyboard doesn't have a key to print screen with.
Found a simple solution - add "+ "Player" is overlapping "Rock" to the event and it changes to being object-specific! But still if anyone has any other methods I'd love to hear them.
Good point s-m-r, I've noticed that seemingly the same event (in a different order) can have a different result. I'll have a play around.
Sketchy snd UrbanMonk, I've never used the later object outside of hiding and showing layers, know of any good tutorials on all it's features?
Riptide, yeah that works perfectly but only when you have one instance of the object in question in a scene, having multiple objects in a level (as per my screenshot) causes some issues