Jump to content

Tiled map Editor json id


SuperMarco
 Share

Recommended Posts

Hi,

 

I just started to use Tiled Map Editor (to create my debug map for now to develop all of the feature of my game), but every time I use it it show the wrong id inside my json file.

 

Example :

 

JbkVLnD.jpg

 

As you can see here I have 4 images (don't pay attention to the cut one on the right, its just to explain my problem), so the id should be 0, 1, 2, 3. 

 

When I use Tiled and export it : instead of 0 it's 1 and instead of 1 its 2 etc..

 

I have read that is because for tiled, the 0 correspond to a "no tile", but I don't know how I can fix this..

 

Most likely my code looks like this :

preload: function() {		this.game.load.tilemap('mainLand', 'assets/mainLand.json', null, Phaser.Tilemap.TILED_JSON);		this.game.load.image('tileset', 'assets/grassland.png');	},	create: function() {		this.ground = this.game.add.tilemap('mainLand');		this.ground.addTilesetImage('tileset');		this.layer = this.ground.createLayer('Main land');		this.layerDetail = this.ground.createLayer('Detail');		this.layer.resizeWorld();	},

Can someone help me to fix this ?

 

Thanks ! :)

Link to comment
Share on other sites

I remember tiled reporting different ids from what i expected because it used a white block as a different image (let's say that there are 3 images , tiled created a white block so the images would then be 4).

 

I tried to cheat a bit letting a blank area at the beginning, but its still not really working.. or working ish.

 

Is there is a way to use options somewhere in the code to change that ? or I have to edit the json file by hand? ^^'

Link to comment
Share on other sites

Hi. I had this problem too but im not at pc and i cant check the json. The tilemap png name is same what have u used when build your map in tiled editor? Coz is it possible u need one more argument in add tile set image. Check the example.

Im sure the tilsetimage is bad. But im newby.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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