don't move!!

Hello everyone, I have a problem, I have an actor who chases another actor, but I do not want to go up and down unless it touches another object, how can I prevent you from moving up and down? sorry for my English Thanks
Comments
Darren.