# Populating objects from Tiler JSON

**URL:** <https://phaser.discourse.group/t/populating-objects-from-tiler-json/890>\
**Category:** Phaser 3\
**Created:** [January 23, 2019, 11:56am UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890 "2019-01-23T11:56:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thompsonplyler](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thompsonplyler/32/565_2.png) [@thompsonplyler](https://phaser.discourse.group/u/thompsonplyler)\
**Post date:** [January 23, 2019, 11:56am UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/1 "2019-01-23T11:56:39Z")

</div>

Hi, everyone. First week using Phaser, so I apologize for any uber-newber questions I may be asking.

I have managed to populate my scene with the tileset from a json I made in tiler. So far so good.  
I can’t  
function preload(){  
this.load.tilemapTiledJSON(‘map1’,‘dist/assets/tile/phaser-proj.json’)  
}

```
    function create ()
    {

        const map1 = this.make.tilemap({key: "map1"});
        const tileset = map1.addTilesetImage("overworld", "overworld");
        const worldLayer = map1.createStaticLayer("ground", tileset, 0, 0);

```

Within that json there is another layer referencing objects in the world. I can’t seem to populate the world with said objects.

Also, I’m a bit confused as to what to do next in order to get that group of objects to collaborate with  
this.physics.add.overlap to make them act like the objects they are (coins, in this case).

My testing overlap works fine. I can run my player sprite over the coins when I toss them out as

```
   coins = this.physics.add.group({
        key: 'coin',
        repeat: 11,
        setXY: { x: 12, y: 0, stepX: 70 }
    });

```

As it shows in the basic tutorial. So my function to snatch the coins works, I can move my player sprite around the map, but I can’t populate the map with objects indicated in the json and, once I’ve populated the map as I need, I don’t know how to add the newly populated coins to a group that can be overlapped by the player.

Thanks for your help. Really excited to work with Phaser!

---

<div class="post-metadata">

**Author:** ![B3L7](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/b3l7/32/25_2.png) [@B3L7](https://phaser.discourse.group/u/B3L7)\
**Post date:** [January 23, 2019, 1:11pm UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/2 "2019-01-23T13:11:50Z")

</div>

If you haven’t already take a look at this:

[https://labs.phaser.io/edit.html?src=src\game%20objects\tilemap\static\create%20from%20objects.js](https://labs.phaser.io/edit.html?src=src%5Cgame%20objects%5Ctilemap%5Cstatic%5Ccreate%20from%20objects.js)

---

<div class="post-metadata">

**Author:** ![thompsonplyler](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thompsonplyler/32/565_2.png) [@thompsonplyler](https://phaser.discourse.group/u/thompsonplyler)\
**Post date:** [January 23, 2019, 1:52pm UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/3 "2019-01-23T13:52:03Z")

</div>

Thanks. I’ll check it out and report back here with the results. It looks like just what I needed.

---

<div class="post-metadata">

**Author:** ![thompsonplyler](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thompsonplyler/32/565_2.png) [@thompsonplyler](https://phaser.discourse.group/u/thompsonplyler)\
**Post date:** [January 24, 2019, 1:20am UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/4 "2019-01-24T01:20:52Z")

</div>

Worked like a charm! Unfortunately, I’ve been struggling mightily when it comes to turning the resulting sprites into physics objects.

I’ve looked at what seem to be relevant tutorials and pieces of the doc, but I’m at a loss.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [January 24, 2019, 2:06am UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/5 "2019-01-24T02:06:09Z")

</div>

```javascript
this.physics.world.enable(coins);

```

or

```javascript
var group = this.physics.add.group({/* … */});

group.addMultiple(coins);

```

---

<div class="post-metadata">

**Author:** ![thompsonplyler](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thompsonplyler/32/565_2.png) [@thompsonplyler](https://phaser.discourse.group/u/thompsonplyler)\
**Post date:** [January 24, 2019, 2:57am UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/6 "2019-01-24T02:57:23Z")

</div>

Awesome. Thanks for helping a newb. I really appreciate it. I’ll try this and report back.

---

<div class="post-metadata">

**Author:** ![thompsonplyler](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/thompsonplyler/32/565_2.png) [@thompsonplyler](https://phaser.discourse.group/u/thompsonplyler)\
**Post date:** [January 24, 2019, 10:59am UTC](https://phaser.discourse.group/t/populating-objects-from-tiler-json/890/7 "2019-01-24T10:59:07Z")

</div>

> [@samme](#):
>
> this.physics.world.enable(coins);

This worked perfectly, although I maddeningly had to hunt for other solutions because when I implemented that my browser decided to start only loading the cache, thus obfuscating the fact that I was not encountering the same error repeatedly despite changing code but that I was, in fact, loading the same code. That was fun. But it worked! Thanks a million.
