Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Invalid layer ID (JSON-Tilemap)


paingraph
 Share

Recommended Posts

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: null

Uncaught 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

  • 1 year later...
 Share

  • Recently Browsing   0 members

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