paingraph Posted September 2, 2014 Share Posted September 2, 2014 I want to use a tilemap i created with Tiled in JSON-format.I'm doing everything like in the tutorials, but the the console says Tilemap.createLayer: Invalid layer ID given: nullUncaught TypeError: Cannot read property 'resizeWorld' of undefined Here's the code:var game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameDiv', {preload: preload, create: create, update: update});function preload(){ game.load.image('tileset', 'assets/tileset.png'); game.load.tilemap('map', 'assets/lvl1.json', null, Phaser.Tilemap.TILED_JSON); }var map;var layer;function create(){ map = game.add.tilemap('map'); map.addTilesetImage('tileset'); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); map.setCollisionBetween(0, 20); }function update(){ }What am i doing wrong ? sorry for my English Link to comment Share on other sites More sharing options...
Stucky Posted December 3, 2015 Share Posted December 3, 2015 I also had "Invalid layer ID given: null" problem and it took me a few hours on the internet trying to solve the problem.For me, changing the encoding of the JSON file to "CSV" instead of "base64" works. You might want to try that. Link to comment Share on other sites More sharing options...
Recommended Posts