How get object of class Tile?

I can’t get and use object of class Tile. The programm is crushing.
Please help!

I do this :

   var map = this.make.tilemap({ key: 'map'});   
   var tileset = map.addTilesetImage('pesok_frames', 'tiles'); 
   var pesok_layer = map.createDynamicLayer('my_layer', tileset);   

   pesok_layer.setCollisionByExclusion(-1, true); 

  const one_tile = pesok_layer.getTileAt({ tileX:60,  tileY:10});

Than when I try to use any methods of class Tile , program crashes. For excample :

one_tile.destroy();

or
test_text = this.add.text(50, 470, 'one_tile.x: ’ + one_tile.x + ', one_tile.y: ’ + one_tile.y);

Show us the errors in your dev console. To me it looks like one_tile returns undefined and you’re trying to get its properties which results in an error in JS.

1 Like

Check the documentation for getTileAt. It takes the coordinates as two parameters, not as an object. Try getTileAt(60, 10) instead of your current code.

Even if this does turn out to be the only problem, keep in mind what oL-web said. The errors you’re getting are almost always required to figure out what’s wrong and it’s hard to help without them.

Thanks, but it also don’t works :
getTileAt(60, 10)

I am a nuber, can you help me please where can i debug my game ? I try to do it in Visual Studio Code, but the problem is I can’t in .js file add path phaser/dist/phaser.min.js .
This doesn’t work: document.write(‘script type=“phaser/dist/phaser.min.js” >’);
I get error “document is not defined”

So I resolved problem
getTileAt(tileX, tileY ) tileX, tileY - in tile units, not pixels.
It’s my neglection, I didn’t look in tutorial carefully.
And also now I installed Debugger for Chrome in VSC and it works fine.
Thanks everyone !