Help needed with collisions on TilemapLayer

Hi all,
I have this big problem and although I have tried a lot of things it seems I’m not able to solve it.

Scenario:
I have a TileMap with many layers but only one of these layers is used for checking collisions (and overlapping).
In this layer I have only 2 values:
1 the tile is walkable
2 a wall and the tile is not walkable

All works fine but when I need to remove a wall (imagine the player opened a door) a weird thing happens.
This is what I do in sequence:

// I replace the wall tile with the empty one
this.scene.map.replaceByIndex(2, 1, col, row, 1, 1, this.scene.colliders)
// I get the tile and I change the collide of the tile
let tile = this.scene.colliders.getTileAt(col, row);
tile.collideDown = false;
tile.collideUp = false;
tile.collideLeft = false;
tile.collideRight = false;
// I recalculate the collisions
this.scene.colliders.setCollision(2);

This works, BUT the walls that stand just next to the wall I removed get weird behaviour.
It seems they work okay but if I try to walk over them by the direction where previously there was the wall I removed, I can walk over them! In any other directions they block the player but from that one they fail.

I’ve tried a lot of things, for example I got the nearby tiles and set on them collideLeft…collideRight etc etc on true but nothing.
I’ve tried to remove and add them again (after a setTimeout)… nothing.
I’ve tried also to call setCollision with all the parameters at true (over all recalculateFaces) but nothing.

Any idea or workaroud?
Thanks in advance!

Remove all of that and do instead

this.scene.colliders.putTileAt(1, col, row);

(corrected)

1 Like

Thanks a thousand times!
it worked like a charm! (putTileAt)

Meanwhile I have found a workaround, I created two immovables and invisibles sprite on the left and on the right of that wall (or up and down depending on the direction).
It works but yours is the real solution!