bitbrain / braingdx

:video_game: Game jam framework based on libgdx.
Apache License 2.0
83 stars 1 forks source link

Isometric TiledMap integration 🗺 #72

Open bitbrain opened 7 years ago

bitbrain commented 7 years ago

As explained in https://github.com/libgdx/libgdx/wiki/Tile-maps we need Isometric tmx integration. braingdx already integrates with Orthogonal tiled maps.

The new renderer implementation

Instead of rendering every layer onto each other, we gonna create n textures, which are rendered per diagonal row. This also works for uneven sizes since we're extending the texture (in an extreme case) to a total width. The render x position is always the isometric position on the most-left tile:

rendering

NOTE: This renderer does not care about roofs etc for now. It simply backs a single texture per diagonal row!

This renderer furthermore re-uses textures if they're exactly the same. It calculates a string according to its contents to use it as a row-id. If a row would require the exact same texture, use the existing texture instead. Also this renderer creates for every row a new GameObject and sets it to inactive (so it doesn't get considered as an actual gameplay object`. Assign renderers for every game object.

NOTE: the texture backing must consider offsets as well. It should back textures according to contents on a cell including offsets!

bitbrain commented 7 years ago

@gterminator this will be the new isometric TiledMap rendering we'll be using in future. It allows us to have proper rendering including z-indexing. 👍