So I finally decided to restart my fighting game. I've begun working on 8-directional controls like in Final Fight, Streets of Rage, etc.
My problem is that I can't figure how to make enemies move behind another when they move "farther" from each other. By farther, I mean higher on Y-axis. I tried making a check like so:
Enemy.Y is greater than Enemy.Y
Move to bottom of layer
Doesn't sound very logical, especially when working with masses of enemies. Whenever enemy passes another on Y-axis, it's instantly sent behind the entire crowd. I'm not sure if this is even possible to fix without serious scripting, but any help would be appreciated.
Another thing. How do I prevent z-fighting? I mean, the enemies try to align themselves with my Y-axis to attack. This causes the crowd to start "flashing" because they are overlapping each other.
Thanks in advance.