Jump to content

One tilemap, multiple layers, each with it's own tileset?


Recommended Posts

I'm trying to make a construction game where the player has to place powerlines and water pipes.

I'm trying to bunch all this together in a single tilemap. What I want is a layer to draw powerlines and a layer to draw pipes but I can't figure out how to assign a tileset to a particular layer?


        // Create the tilemap
        oGame.tilemap = oGame.add.tilemap();

        // Add tilesets to the map
        // Create tilemap layers
        oGame.tilemapLayers = {
            'waterSupply': oGame.tilemap.create('waterSupply', 40, 40, _iTileSize, _iTileSize),
            'electricSupply': oGame.tilemap.createBlankLayer('electricSupply', 40, 40, _iTileSize, _iTileSize)

        // Resize the world to the correct size

         // Draw tiles
        oGame.tilemap.putTile(0, 10, 6, 'waterSupply');
        oGame.tilemap.putTile(0, 10, 6, 'electricSupply');

Link to comment
Share on other sites


  • Recently Browsing   0 members

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