Additionally added IsMovingVertically for potential edge cases where vertical movement needs to be considered.