Side-To-Side Movement?

So back in VX Ace, I used a special movement effect to make an enemy NPC that body-blocks you from accessing an area until you defeated them - it does this by intercepting your horizontal location. Here's what it looks like:

move_straight(4) if $game_player.x < @x
move_straight(6) if $game_player.x > @x

What's the MV equivalent of this?
Code:
if ($gamePlayer.x < $gameMap.event(this.eventId()).x)
    $gameMap.event(this.eventId()).moveStraight(4)
if ($gamePlayer.x > $gameMap.event(this.eventId()).x)
    $gameMap.event(this.eventId()).moveStraight(6)
Thanks for that, Turan. Thread is solved.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/side-to-side-movement.168129/