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!