Jump to content

Preserving order of Tiled map layers in Tilemap object


Dannflower
 Share

Recommended Posts

I'm currently working on automating the loading process of my tilesets/sprites/Tiled map data into my application and I've run into the following snag:

When creating the layers of my map (i.e. invoking myTilemap.createLayer(...)) I cannot see any obvious way of preserving the order of tile layers and object layers as they were in the Tiled JSON. From what I can see in the Phaser docs and in Phaser.js itself, it appears that Phaser parses out the tile and object layers into separate groupings within the Tilemap object:

layers[] & objects{} respectively.

This is fine, but there's no way I can see to tell where my object layers are supposed to be relative to the tile layers. For instance, I have this in Tiled:

Tile layer 1

Object layer 1

Tile layer 2

But in the Tilemap object, I get:

layers = [Tile layer 1, Tile layer 2]

Objects = {Object layer 1}

Without relying on naming convention, I can't tell that object layer 1 is between the two tile layers. Am I missing something or is this just the way it is right now? I've got plans to refactor the Phaser.js code locally to address this, but I wanted to reach out here before getting my hands dirty to see if I am missing the easy solution.

Thanks in advance for any pointers!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...