You could write a function using the previous MoveDirection value and the new one to find which co-ordinate changed.
MoveDirection