Right now, in my game, to handle depth(like which entities are behind eachother) so that entities appear correctly layered behind one another, what I do is this:
- Each entity has a depth (negative y position)
- Each loop of the game, I run my whole ArrayList of entities through the sorting method of who has a higher depth than others etc.
That did the trick, but sometimes it says I’m violating the contract I gave to the sorting method, but at other times the depth doesn’t work.
Anyone have a better solution/fix to what im doing?