HeroesGraveDev's version will work, also check
this out.
I really think you should use google/your own brain a bit more, though...this is a problem easily solved just by thinking, and even if that fails you can always search.
I've already got a full system implemented. The ball moves, bounces, collides, all that. I just don't like the way it moves. I've been racking my brain over this for a few days now and the only thing i've been able to come up with is detecting the degree of the angle before it hits a wall and compensating..I just haven't been able to figure out how to put this into code yet.
Believe me, i've been searching and thinking about this. I try not to ask anything here until i've fully researched it...Maybe i'm just researching it wrong, but like I said, I couldn't find what I was looking for. His solution above, doesn't even have anything to do with what i'm asking...But thank you.