mirvine Posted November 17, 2018 Share Posted November 17, 2018 Hi, I created a simple tilemap with tiled, and I'm trying to load it. The code and files can be seen here: https://codesandbox.io/s/qqq47wqv3w I'm not getting any errors in the console, but the canvas is just a black square. Any ideas what I am doing wrong? var game = new Phaser.Game(config); function preload() { this.load.image("tiles", "assets/tiles.png"); this.load.tilemapTiledJSON("World", "assets/tilemap2.json"); } function create() { this.map = this.add.tilemap("World"); var tileset = this.map.addTilesetImage("tiles", "tiles"); his.backgroundLayer = this.map.createStaticLayer("World", tileset); } The timemap.json from Tiles is below: { "height":100, "infinite":false, "layers":[ { "data":[3, 3, 3, 3, 3, 3, 3, 3, ...[data omitted]..., 3, 3], "height":100, "id":1, "name":"World", "opacity":1, "type":"tilelayer", "visible":true, "width":100, "x":0, "y":0 }], "nextlayerid":2, "nextobjectid":1, "orientation":"orthogonal", "renderorder":"right-down", "tiledversion":"1.2.1", "tileheight":8, "tilesets":[ { "columns":8, "firstgid":1, "image":"tiles.png", "imageheight":48, "imagewidth":64, "margin":0, "name":"tiles", "spacing":0, "tilecount":48, "tileheight":8, "tilewidth":8 }], "tilewidth":8, "type":"map", "version":1.2, "width":100 } Link to comment Share on other sites More sharing options...
jest Posted November 17, 2018 Share Posted November 17, 2018 line 36, typo his.backgroundLayer = this.map.createStaticLayer("World", tileset); //should be "this" there are lots of phaser tiled examples here: https://labs.phaser.io/index.html?dir=game objects/tilemap/&q= mirvine 1 Link to comment Share on other sites More sharing options...
Recommended Posts