Reversing direction

I need help trying to reversing the direction of an image once it collides with an object

here my code so far


Here's how to bounce off something using math: