LibGDX Sprite/Tile rendering behind and in front of a object -


quick facts:

  • i'm using tiled tile-editor.
  • i'm using libgdx. got work old pokémon styled game.

my problem:

i'm not creating pokémon. sprite 60x20 pixels, want bottom 20x20 pixels (my feet) collision area.

now, take tree, 20x20pixels unwalkable bottom:

when i'm coming bottom, want 40 pixels above feet showed infront of tree. means 20 pixels infront of bottom, , 20 pixels above, infront of actual trees. but, when i'm standing above bottom of tree, want player completly covered behind tree.

when programming without libgdx (to desktop, low low-end) rendered pixels above position first, checked items go above/below me, , rendered else.

now, don't know anyway render couple of pixels when i'm using orthogonaltilemaprenderer.

i think there no solution using tiledmaprenderer render whole layers.

imagine have 2 trees, 1 above other 1 tile of space in between. character standing on 1 tile , between both trees. behind 1 , in front of other one. in case impossible render whole layer @ once standard way, because character either in front of both, or behind both trees.

you can still create map using tiled, need analyze special layer objects , convert list of entites can apply manual z-ordering (well, y-ordering in 2d-space) background foreground , render them individually in correct order.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -