Jump to content

Multiple Tilesets for one layer


cesco_p
 Share

Recommended Posts

I am sorry if this topic exists already, but I struggle with this problem now for hours and I have no clue how to solve it.

I created a tilemap in tiled, and there is a layer which uses multiple tilesets. However, if I want to create a new Dynamic Layer with Phaser, 

I have to specify one tileset for the layer:

var dekoimg = map.addTilesetImage('spikes');
var layer = map.createDynamicLayer('Deko', dekoimg, 0,0);

Is there a way to  use multiple tilesets instead of only one?

Thanks in advance

Link to comment
Share on other sites

It looks like Phaser doesn't currently support multiple tilesets PER LAYER. The current type accepted by the create layer methods are string only it looks like. :(

You can however use multiple tilesets on different layers in the same map atlas. You could just use one layer with one tileset in mind and another with a different set in mind?

Link to comment
Share on other sites

  • 1 year later...

It is possible, you just need to pass the data as an array. Please check `createDynamicLayer` method on the Tilemap class https://photonstorm.github.io/phaser3-docs/Phaser.Tilemaps.Tilemap.html

Check the attached screen from my working project and this GitHub example https://github.com/photonstorm/phaser3-examples/blob/master/public/src/game objects/tilemap/static/multiple tilesets.js

Capture.PNG

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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