So I had a quick question. I'm currently making a small game in java and I wanted to experiment with hiding the player behind fake 3D objects on the screen (Isometric drawing). Unfortunately I can't post a picture (Not enough rep). Basically it's a 3D block that is 32 by 48 that gives an illusion that it's 3D by having half of it a lighter color and the other half a darker one. The player is the same size as the block and can move freely around the map of these 'blocks'. If the player moves behind a block, it's bottom part is hidden behind it. The opposite when it moves in front, covering the non-player block. Now I made an example program in GameMaker Studio just to test it out. To make it work in GM, I made a script for each sprite that was one line of code:
depth = y * -1
This causes the bottom part of the player to 'hide' behind the blocks when it moves behind them. I looked into it a bit on GM's wiki and it's pretty much changing the 'depth' of the instances. Now my question is, how would I do something like this in Java?
P.S. This is not in a diamond. It is in a straight 2D world (looking 45 down towards objects from front).
EDIT: Here are some pictures of the GameMaker version:
Thanks to Kayaman for solving the problem:
Just for future use, layering images in java is determined by the order in which they are added. This was the exact answer I was looking for. The GM code was GameMaker's way of setting the order in which the images were added to the screen.
Thanks to everyone for the help!