Jump to content

How do I load tile map with phaser 3


Recommended Posts


I created a simple tilemap with tiled, and I'm trying to load it. The code and files can be seen here:


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,
         "data":[3, 3, 3, 3, 3, 3, 3, 3, ...[data omitted]..., 3, 3],


Link to comment
Share on other sites


  • Recently Browsing   0 members

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