I think Ashley had a tutorial about this part. It explained that principle where you can make an enemy sort of "patrol" and I think that is what you are after. It is the platformer tutorial.
Essentially, however, what you do is create 2 sprites (just any colored squares would work) and place them exactly at the two points where your ball should move back and forth just like the below:
* o * (the 2 square sprites would be the * and the ball is the o)
Next you would add the bullet behavior to the ball (or the 8 direction movement and restrict it to 2 directions).
You would want a condition then checking if the ball collides with one of the 2 sprites and add an action to reverse the direction of movement of the ball.
I believe that should solve the problem.