Jump to content

How make overlay layers for CSV into Phaser 3?


Recommended Posts

Hello all!
I'm make top down game in Phaser 3.9.0 and have a problem.
I'm created map in Tiled ver. 0.18.2. and export it in .CSV.

Editor map

It turned out , 5 files = 5 layers.

How all of them combine to a mp?

My code.

function preload ()
	this.load.image('tiles', 'assets/map/tileset/tilesheet.png');
    this.load.tilemapCSV('map', 'assets/map/csv/world_ground.csv');
	this.load.tilemapCSV('map', 'assets/map/csv/world_groundvariations.csv');
	this.load.tilemapCSV('map', 'assets/map/csv/world_grass.csv');
//and other...
function create ()
	map = this.make.tilemap({key : 'map', tileWidth: 32, tileHeight: 32});
	var tileset = map.addTilesetImage('tiles');
    ground = map.createStaticLayer(0, tileset, 0, 0);
	grass = map.createStaticLayer(1,tileset,0,0);

Error: Cannot create tilemap layer, invalid layer ID given: 1

This is what is displayed on the screen.
Only First Layer


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.

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.


  • Recently Browsing   0 members

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