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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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