Jump to content

problem with tiled and json


flippy
 Share

Recommended Posts

hi, so im having a problem when trying to use a json this is my code

 

 

function preload()

{

game.load.tilemap('tilestest','Assets/tilestestmap.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles','Assets/tilestestmap.png');

}

function create() {

//creating the map

map = game.add.tilemap('tilestest');

map.addTilesetImage('tiles');

layer = map.createLayer('tiles1')

layer2 = map.createLayer('objects');

layer3 = map.createLayer('extracollision');

layer4 = map.createLayer('collisionlayer');

layer.resizeWorld(); layer.wrap = true;

}

 

the layer names as i know are the names of the layers inside tiled , so that is "tiles1,objects,extracollision,collision"

and i cant figure out what the problem is , console tells me its "Phaser.Tileset - image tile area is not an even multiple of tile size"

and it appears twice for some reason :S

please help :c

 

Link to comment
Share on other sites

it sounds like there is a mismatch between the size of your map in Tiled and the size of your individual tiles. 

What is the width and height of your tiles, and what is the width/height of your map?

The height/width of the map is 10x100 tiles and the size of the tiles is 8x8px.  Do I need to somehow specify that the map size unit is tiles and the tile size is in pixels?

 

I've been shifting things around on the map and now I'm getting an error "Uncaught TypeError: Cannot read property 'style' of null" I'm not sure that is related to the original issue though.  I might make a new post.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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