Jump to content

Phaser.Loader - tilemap[map]: JSON Parse error: Unexpected EOF


jmg
 Share

Recommended Posts

 

Hello

I cannot load the map (made using Tiled Map Editor) using Phaser.

Phonegap Desktop console shows this messages:

Quote

 Phaser.Loader - tilemap[map]: JSON Parse error: Unexpected EOF
200 /socket.io/?EIO=3&transport=polling&t=Le8nta0&sid=emu6enEhW3ZDnahlAAAB
 Phaser.Cache.getTilemapData: Key "map" not found in Cache.
 Phaser.TilemapParser.parse - No map data found for key map
200 /socket.io/?

 

In function "preload" i have this code:

game.load.tilemap('map', 'assets/mapas2.json', null, Phaser.Tilemap.TILED_JSON);
game.load.image('tiles', 'assets/tmw_desert_spacing.png');

 

In function "create" i have this code:

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

    //  Now add in the tileset
    map.addTilesetImage('tiles', 32, 32);
    
    //  Create our layer
    layer = map.createLayer(0); 

    //  Resize the world
    layer.resizeWorld();

 

mapas2.json:

{ "height":16,
 "layers":[
        {
         "data":[30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 26, 26, 26, 26, 26, 26, 27, 30, 30, 33, 36, 42, 42, 42, 42, 37, 35, 30, 30, 33, 35, 25, 26, 26, 27, 33, 35, 30, 30, 33, 35, 33, 36, 37, 35, 33, 44, 27, 30, 33, 35, 33, 35, 33, 35, 41, 37, 35, 30, 33, 35, 33, 35, 33, 44, 26, 45, 35, 30, 33, 35, 33, 35, 41, 42, 42, 42, 43, 30, 33, 35, 33, 35, 25, 26, 26, 27, 30, 30, 33, 35, 33, 35, 33, 36, 37, 35, 30, 30, 33, 35, 33, 35, 33, 35, 33, 44, 26, 27, 33, 35, 33, 44, 45, 35, 41, 42, 37, 35, 33, 35, 41, 42, 42, 43, 30, 30, 33, 35, 33, 44, 26, 26, 26, 26, 26, 26, 45, 35, 41, 42, 42, 42, 42, 42, 42, 42, 42, 43, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
         "height":16,
         "name":"Capa1",
         "opacity":1,
         "type":"tilelayer",
         "visible":true,
         "width":10,
         "x":0,
         "y":0
        }],
 "nextobjectid":1,
 "orientation":"orthogonal",
 "renderorder":"right-down",
 "tileheight":32,
 "tilesets":[
        {
         "firstgid":1,
         "source":"\/tmw_desert_spacing.tsx"
        }],
 "tilewidth":32,
 "version":1,
 "width":10
}

 

Here I leave you 2 files just if you want to try it.

Tank you very much!

 

tmw_desert_spacing.png

tmw_desert_spacing.tsx

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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