Conditional branch if player moves from tile in _____ direction?

I know there's a way to check what direction our player is facing but is there any sort of way for me to check a condition ONLY if the player moves off of a tile in a certain direction?
To briefly explain I basically have common events being triggered by the player's placement on certain region tiles, these common events erect walls alongside the character when they're facing certain directions that prevent enemy knockbacks from transferring them over to another map. This works great but when the player passes one set of double-sided walls to one area when they attempt to do the same over again to the next area yet they are blocked due to the last check they passed detecting the direction of the character and erecting the opposite wall... if that makes sense. The common event only runs once when they player touches it and can only detect direction.
If I could run a separate conditional branch alongside it to detect the player moving FROM that tile in a certain direction I could fix this.
You can do
if($gamePlayer.isMoving() && $gamePlayer.direction(x))

Edit: Sorry, it's
if($gamePlayer.isMoving() && $gamePlayer.direction()==x)
You can do
if($gamePlayer.isMoving() && $gamePlayer.direction(x))
Excuse my stupidity but for "X" then you would just insert right, left, etc? any sort of special formatting? Also would they have to be run as separate conditional branches funneling into one another or could they both be run together at the same time?
Excuse my stupidity but for "X" then you would just insert right, left, etc? any sort of special formatting? Also would they have to be run as separate conditional branches funneling into one another or could they both be run together at the same time?
It actually goes by 2, 4, 6, and 8 where 2 is down, 4 is left, 6 is right and 8 is up. You can run them together at the same time, or sequentially, depends how you want the checks to run
It actually goes by 2, 4, 6, and 8 where 2 is down, 4 is left, 6 is right and 8 is up. You can run them together at the same time, or sequentially, depends how you want the checks to run
I'm glad I asked because I'd had never guessed that lol. So to run them together I would format it just like that? With the "&&" between them?
So to run them together I would format it just like that? With the "&&" between them?
Yes, that's javascript syntax for multiple conditionals
Yes, that's javascript syntax for multiple conditionals
Alright, so quick question. I set up a test before I implemented it where I would just have an event pop up for me to see if all the conditions were met. First I tried running them together using the "&&" like you showed with the direction being "6" which should be right, and the event would appear anytime I moved in any direction at all. The second time I did them separately (posted a photo below) and now I can't seem to get it to pop up at all. Any ideas as to what I'm doing wrong here?

barriertest.png
Alright, so quick question. I set up a test before I implemented it where I would just have an event pop up for me to see if all the conditions were met. First I tried running them together using the "&&" like you showed with the direction being "6" which should be right, and the event would appear anytime I moved in any direction at all. The second time I did them separately (posted a photo below) and now I can't seem to get it to pop up at all. Any ideas as to what I'm doing wrong here?

View attachment 315149
My bad, minor adjustment. I believe this is the way I intended it to be. Back to the same issue of the event appearing anytime I move in any direction.
barriertest2.png
Try changing it to $gamePlayer.direction()==6
Try changing it to $gamePlayer.direction()==6
That did the trick!

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-if-player-moves-from-tile-in-_____-direction.171228/