There are two object in the world. One object should move downward, and when it is in the same level as the object at the bottom. The object at the bottom should upward. How do you make that?
Try to break the problem down and ask for help that's specific to the part you're trying to accomplish right now. (Examples of how to do this are here, see sections 3 and 4 in particular).