How to make an object move after another object along y x

how to make an object move after another object along y x