Dynamic layer overlapping

Hey I’m trying to make a game
I created a layer in tiled with objects to collect and them I’m creating a dynamic layer to display the objects and trying to do an overlap with then and the player and delet that object but unsuccessfully.
HELP PLEASE
I’ve no ideia what to do because the code simply doesn’t work :confused:

Please post a code snippet so that we can see what you are doing.

var starTile = map.addTilesetImage(‘star’, ‘star’);
this.star = map.createDynamicLayer(‘starTiles’, starTile, 0, 0);
map.setTileIndexCallback(11, this.collectStar, this);
this.physics.add.overlap(this.player, this.star, this.collectStar, null, this);

Thanks. Ok, without more context it’s hard to tell but it looks like there are two lines that can be fixed.

First I think it should be:
this.star.setTileIndexCallback(11, this.collectStar, this);

Then, since you already have set a callback function for the star layer, you can simplify the overlap:
this.physics.add.overlap(this.player, this.star);

Hope that helps. If you haven’t already, check out this example:
https://labs.phaser.io/edit.html?src=src\game%20objects\tilemap\collision\tile%20callbacks.js