How to update the player tile when entering a room at a specific place

I have the player in my game set up to look in the direction they are moving in. I also wanted to them appear to be "behind" certain background tiles while moving (not just totally hidden), so in the player update section I included code to identify those background tiles and swap them out for different ones depending on which direction the player enters the tile. (I had originally tried to make this work using draw like I do when using hide, but couldn't get that to work.)

if tilename=="Name of the Tile" then
if event.dx<0 then
swap "Person W Name of the Tile"
elseif event.dx>0 then
swap "Person E Name of the Tile"
elseif event.dy>0 then
swap "Person S Name of the Tile"
elseif event.dy<0 then
swap "Person N Name of the Tile"
end

This works for tiles within a room perfectly, but when the tile is on the edge of a room or an exit, when the player appears in the next room the replacement tile (e.g., "Person W Name of the Tile") remains visible, not the usual player directional tile with nothing obscuring it. The player sprite only reappears when the player moves or the idle animation I have set up starts.

Is there a way to force a particular tile to be drawn as the player enters a new room? One issue is that it would have to only happen on specific locations where a player was previously on one of those special "player appears behind stuff" tiles.

Hopefully this makes sense. And maybe I'm just going about this all wrong!

What if you store the player direction and "special tile" state as variables? Then you could use conditional logic to determine which tile to draw based on them.

Thanks for the idea, though I finally figured out something that worked. There are probably far better solutions out there.

I had tried to call update on entering a room, but that didn't work. Telling the player sprite to swap when entering on particular tiles did work well, and was the easiest to implement, but then the idle animation I had set up would break that.

In the end I chose to hide the player when entering a room on those particular tiles (so you couldn't see the idle animation) and swap a tile that looked like the player facing a direction behind some scenery. The downside with that was that the tiles around it needed to unhide the player and swap a regular tile back from where they entered (and have the tiles return to normal on exit). But I only did this in a few rooms, so it wasn't too bad.