Hey JavaGaming!

Never before has something worked for me, until just recently. This is because of you guys, and explosively learning
my ways with games programming

I'm over stuff like walking in a tilemap, which you know I have had trouble with.
So a massive thanks to you
Now to my question:I got a fingerpoint (a huge one) to how I should proporly Z-order my tiled-landscape-thing (it
s top-down, like Zelda). I'm using the comperable interface on my "entity" object to do it.
I have a feeling I might be doing it in a bad way though, since it does not always work..
Have a look:
1 2 3 4 5 6 7 8 9 10 11 12 13
| public int compareTo(Entity o) { if (this.coordY > o.coordY) { return 1; } else if (this.coordY == o.coordY) { if (this.priority > o.priority) { return 1; } else { return -1; } } else { return -1; } } |
It's designed to make the objects in the scene that has the biggest Y value, the first on the list (a linkedlist btw).
If they have the same Y, the priority int should count, and the one with the biggest priority should be first.
..I do have a feeling I might be doing this waaaay wrong, hence the half-funcionality..