1. Maybe you could define a variable [faceDirection] to your main character (ex 0=left, 1=right)
2. if you using keyboard to controll him, the last input event is :
(1) Left arrow then set this variable to 0
(2) right arrow then set this variable to 1
3. Calculate the distance between main character(M) and boo(B)
(1) d = M.x - B.x
-> [d > 0] means boo is in the right
-> [d < 0] means boo is in the left
4. Check main character is facing boo or not?
(1) if faceDirection is Left (0)
-> if [d > 0] ===> Move!
-> else ===> Stop!
(2) else (faceDirection is Right(1) )
-> if [d < 0] ===> Move!
-> else ===> Stop!
Hope this help!