Hi,
those code lines should move the entity towards the player. Any surrounding entity blocking the up and down movement? Missing IGNORE_PASSABLE or so?