[Help for a Newb Please] Tiled Error: "Invalid Tileset Image: floortileset"

In trying to import my map from Tiled, I am getting the following error:

r/phaser - [Help] Tiled Error: "Invalid Tileset Image: floortileset"

Any suggestions? I included the bits of code I thought were relevant here (omitted spritesheets, etc)

Preload()

this.load.image("floortileset", 'floortileset.png');

var json = require('./map.json');
this.load.tilemapTiledJSON(this.MK, json);

Create()

this.Map = this.make.tilemap({key: this.MK});
const tileset = this.Map.addTilesetImage("..\/agora\/front\/src\/Phaser\/Game\/floortileset.png", "floortileset");

const starter = this.Map.createStaticLayer("start", tileset);
const worldLayer = this.Map.createStaticLayer("Tile Layer 1", tileset);

Can also include the json file if it would be helpful! Would really appreciate any help I have spent days on this already.

Are you sure the path to the png is correct? Check the Network tab in Dev Tools.
And your key is strange, I canā€™t tell what ā€˜this.MKā€™ is. Something like {key: ā€œmapā€} is more obvious.

1 Like

I got the path to the png based on the JSON file provided to me by Tiled. It is in the same folder as this file, and substituting in ā€œ./floortileset.pngā€ unfortunately doesnā€™t solve it either.

this.MK is the map key (ā€˜MKā€™) I store within the class that this exists within. I tried substituting just ā€œmapā€ into both ā€œthis.MKā€ and no success here either :frowning:

But did you check the Network tab? If it gives a 404, itā€™ll tell you what path it expects.

1 Like

Am not seeing anything under the network tab, or any 404 error in console logs.

Hi,
Try this:

And in Tiled, when you create a map, you must choose embedded tileset (or something like this, i donā€™t remember the exact term

1 Like

Press CTRL-F5 or CTRL-r when in the Network Tab. Does it say 200 or 404?
It canā€™t say nothing.

network

Still seems to be an error @BlunT76 , thank you though.

start and Tile Layer 1 are both tiled layers: "type":"tilelayer",

Perhaps my path in the JSON is wrong? I currently have

"tilesets":[
        {
         "columns":8,
         "firstgid":1,
         "image":"..\/agora\/front\/src\/Phaser\/Game\/floortileset.png",
         "imageheight":272,
         "imagewidth":272,
         "margin":1,
         "name":"floortileset",
         "spacing":2,
         "tilecount":64,
         "tileheight":32,
         "tilewidth":32

}],

Edit: And I did do the embedded tilesheet option

Ah, thanks, I am seeing 304 for most things.

If it helps, here is a screenshot of my GameScene object

Do you have your project on github or somewhere else to test it?

Iā€™ll put it up in a sec ā€“ I am just playing around with another repository and trying to get it to run on my localhost for my own education.

That said, I might have gotten closer to figuring it out. I am seeing that ā€œconst tilesetā€ is null after adding the tileset image, which makes me think itā€™s not being loaded properly.

Iā€™m still not convinced :slight_smile:
Could you check disable cache (in the Network tab header) , and post the result of you hovering over ā€˜floortileset.pngā€™?
Like this:
path2

1 Like

@Milton lol, well you were right I was looking at the wrong thing but looks like it is 200.

Another thing I noticed:
tilesetName - The name of the tileset as specified in the map data

Shouldnā€™t be the problem, but change it to addTileSetImage(ā€œfloortilesetā€); // or whatever you called it in Tiled.

Maybe look at this tutorial.