I'm currently developing a prototype for a tower defense game similar to Plants vs Zombies. Right now, tower placement and deletion works, as well as a basic shooter unit. However, I can't seem to figure out how to control the Z order of the units I create on the board.
As expected, more recent units stay on top.
I tried making the Z order be equivalent to their Y position on the board, but I can't seem to manipulate it further than moving higher or lower. None of the methods I tried to use worked. How could I make it so that higher units always stay on the back without a large amount of unnecessary layers for each lane? (The board may be much larger than this in later stages)
Thanks in advance.
EDIT: Oh yes, here's the prototype's .capx with my original attempt. The hitbox object is due to the unit's actual collision polygon being the tile, thus not being able to check for sprite excess.