Hello again folks, I need to ask for some more advice regarding a scrolling brawler I'm in the process of developing.
I'm having issues regarding layering multiple instances of the same group. At the moment I've got separate ones allocated to the Player, Enemies and Background Objects, and it's a simple process of calling a fast loop whenever the Player overlaps either of the other two, where I check the Player's Y Coordinate which I've set to a variable (I've called 'floor_position', more on that in a moment), if the Player's floor_position is lower than the other Object's the Player moves behind them, if it's greater the Player moves in front, it's pretty straightforward.
The reason I'm using a variable rather than the Y coordinate, is because in games like this you'll often jump or be knocked down, and as you'll be moving up and down the screen a lot this is of course going to change where the floor is at any given time, and so I have the floor_position variable update whenever the player is on the ground, then lock it when they're in the air, this keeps track of where they should be landing.
Now then, the issue I'm having is with the Enemies, they use the same variable to keep track of where they are on the floor, but this is causing issues when they overlap. If you check the attached image, you can see one of the thugs has his bat up over his head as he goes for a jumping attack on the scorpion guy (the player), his shadow is parallel to the player and shrunk slightly because he's airborne, but as you can see, he's overlapped by the other enemies when he should be in front of them.
I've tried using the layering object to solve this, using the Y_Descending ordering command, but whilst that works fine when everyone's on the ground (my guess is that it checks each object's Y coordinate?), if doesn't work when they're airborne.
I've tried several methods of rectifying this, specifying that it only use this layering approach when they're on the ground, moving objects to a higher layering when airborne etc but with no luck, I think I need to find a way to sort by their floor_position variables but don't know how to do it?
Any help would be much appreciated.
Please login to see this attachment.