Jump to content

Check overlap with a specific tile


kurhlaa
 Share

Recommended Posts

Hello,

If I have a tilemap with a dynamic layer, a player with collisions enabled with this layer - how do I manually check whether the player is overlapping specific tile?

I try this way:

scene.physics.world.enable(player);
scene.physics.add.collider(player, layer);

...

var tile = layer.getTileAtWorldXY(Xpos, Ypos, true);
console.log(scene.physics.world.overlap(player, tile));

.. but I always get False printed, even if selected tile is right behind the player. Same result with calling collide(), same result if tile's index is -1 or something else. What am I missing?

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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