melonJS icon indicating copy to clipboard operation
melonJS copied to clipboard

isometric object layer block image ordering

Open createmain opened this issue 5 years ago • 4 comments

If you are submitting a bug report, please respect the below template :

OS platform / Browser

Windows 10 / Chrome

melonJS version

7.1.1

Bug description

isometric object layer block image ordering

Steps to reproduce the bug

execute isometric example

Console log Extract

n/a

image

I tried to add buildings. but the example has layer control approach. So When I move player to back position of the layer object, the player is on the front of the building image.

I think the building object should be object and it should have fixed z-order and the player's z-order should be update along the player's position. how can I make it?

Thanks alot.

createmain avatar Aug 25 '20 15:08 createmain

did we s***** up with he isometric example ? anyway using me.game.world.sortOn = "y" should help with the sorting for the isometric example, I cannot run it right now, but I see that it seems to be missing.

obiot avatar Aug 26 '20 02:08 obiot

ok, so I know what you mean now, and this is actually normal with this example. The issue is the tile used where the rocks here are only made of 2 tile and does not really work so well for this isometric example (maybe grid size should be smaller, or some of the tiles are too big).

it's really something too look at using tiled to better understand what I mean, but in the screenshot here below, you can see the actual tile and collision set in Tiled : Screenshot 2020-08-26 at 4 13 59 PM

and if you look at the next one where I just hid the back layer you can see that part of the other layer is overlapping exactly where you can see the player sprite going through it. Screenshot 2020-08-26 at 4 14 07 PM

trees are working just fine though because there is not such an overall.

hope this helps ! nevertheless the sortOn option is still one to keep in mind !

obiot avatar Aug 26 '20 08:08 obiot

here is tile sample. image

this is execution result. image

here is problem. image

sortOn option didn't work to me.

createmain avatar Aug 26 '20 09:08 createmain

image

I think like this. each building should have own z-index along vertical position. So when the player move, it should check vertical position and update z-index. Then it will work well.

createmain avatar Aug 26 '20 09:08 createmain