You will need to calculate the absolute change in height.
Usually we take the vertical axis as y direction, and horizontal as x direction.
So when you say in the x direction do you mean horizontal? Cause if that's what you mean, then it is incorrect. You will have to take the change in height.