can2nac

How to draw on particular [TMX] layer?

Recommended Posts

Hi,

in Isometric RPG example (https://github.com/melonjs/melonJS/tree/master/examples/isometric_rpg)

is there a way to draw tile selector on particular layer?

For example, i may add some tilesSelector layer to the TMX map.

In the Isometric RPG example the tile selector is drawn on the top of all layers. I would like to draw it on the basement, under player feet.

 

thanks

Share this post


Link to post
Share on other sites

I don't know the answer exactly, but to do something like basement underneath a main floor of a house for example would require much more complex map setup than just layers in an isometric tmx map.

Share this post


Link to post
Share on other sites

it could as simple as setting the correct z order to your "tile selector object" 

and to make it fully dynamic, you can get the required tile z value using the following code (after your map has been loaded) :

// get the TMX Map Layer called "basement"
var layer = me.game.world.getChildByName("basement")[0];

// get the layer z value
var zOrder = layer.pos.z;

then you can just reuse zOrder when instantiating your tile selector, and it should do the trick :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.