javauser-interface2ddepthisometric

Isometric graphics depth handling Java


While drawing graphics in 2D, how can I handle the depth of a picture in the frame? For example the ground would be depth -1 and the player depth 0?

And another question how do I achieve this kind of looking ground? When I say achieve, I mean just the theoretical way of doing it not actual source code, but source code could help.

The picture is a link because I don't have enough reputation

.

My game is Tile based already and it is ready to be drawn in isometric. I have x y and z coordinates in the engine part of the game. I read that you need to translate it into only x and y for drawing in isometric but I'm not sure how or why would i do that.

Here is a picture of my game right now. The coin is the player, and the squares are the Tiles.

One last thing my Tiles are stored in an array, i.e Tile[] tileList. Is that an efficient way of storing it? Because I want the best performance I can get out of my game.

Thank you very much.


Solution

  • You need to look at doing custom drawing. To get a simple isometric game all you need to do is draw the items on each tile in the correct order. In the example above the top square would be the tile in your array at [0][0], the contents of this tile needs to be drawn first. Afterwards you need to draw [0][1] and [1][0], and so on..

    See here for more details: Drawing Isometric game worlds