Pau 1 Report post Posted July 19, 2018 Hello, I am trying to load a tilemap mad with tiled, but i am getting this error in the console: Error: No data found in the JSON tilemap from Tiled matching the tileset name: "gameTiles" This is the code i am using in phaser: function preload(){ this.load.tilemapTiledJSON('level1', 'map.json'); this.load.image('gameTiles', 'tiles.png'); //this.load.spritesheet('gameTiles', '../img/tiles.png', { frameWidth: 32, frameHeight: 32 }); } function create(){ map = this.make.tilemap({key:'level1'}); tileset = map.addTilesetImage('gameTiles'); backgroundLayer = map.createStaticLayer('background', tileset,0,0); } I give you the complete source code in the attachment. It is not so much. Thanks in advance. 1-carga-carretera.zip Share this post Link to post Share on other sites
NoxBrutalis 16 Report post Posted July 19, 2018 When you set tilesetImage(gametiles) you're using the key you gave the texture in game code. there should be an argument before that, and that's the name you gave the tileset image in tiled itself. So, in my game, the key I gave the image was tiles, but in tiled for some reason I called it tilesheet. So I had to do this this.tiles = this.map.addTilesetImage('tileSheet1', 'tiles'); if you called it gameTiles in tiled also, then: this.tiles = this.map.addTilesetImage('gameTiles', 'gameTiles'); Share this post Link to post Share on other sites
Pau 1 Report post Posted July 19, 2018 Thank you! your explanation solved my problem. I share my on code-explanation. function preload(){ this.load.tilemapTiledJSON('level1', 'map.json'); this.load.image('tilesetNameInPhaser', 'tiles.png'); } function create(){ map = this.make.tilemap({key:'level1'}); tileset = map.addTilesetImage('tilesetNameInTiled', 'tilesetNameInPhaser'); backgroundLayer = map.createStaticLayer('background', tileset,0,0); } Thank you! 1 NoxBrutalis reacted to this Share this post Link to post Share on other sites