In C# I saw already the SpriteBatch class (In the XNA plugin for XBOX games). In that class is it posible to paint in layers.
Now I want to do the same in Java because I’m making braid (See my other questions) and I have an ArrayList from all the GameObjects and that list is not made in the correct paintoreder.
For exemple: I have a door but the door is painted on the player.
Martijn
How about sorting the items before rendering?
The background items have to be painted first and the foreground ones last.
If you have a List and items are Comparable you can use
If you need a special order, you can implement your own Comparator.
All that of course requires the items to hold some info on their z-position.
And you shouldn’t do this in the paint method. sort items when they’re changed, ie. added.