title: Bouncing Ball logics
body: <p>I have got a ball which bounces of walls. This bounce is simple, i just do this, ( code snippet )</p>
  
  <pre><code>if ( x - moveSpeed &lt; 0 ) // Ball hit left wall
      xVel *= -1;
  </code></pre>
  
  <p>However i also got a rectangle which the player moves. The bounce on this practically works as the bounce on walls.</p>
  
  <p><img src="https://i.stack.imgur.com/G4mHH.png" alt=""></p>
  
  <p>But i figured out that when a ball got similar movement as the picture, its impossible for me to make it go straight up again. I therefore need some kind of calculation regarding the rectangles movement to influence the outcoming angle of the ball. The rectangle always got a constant movement speed when moving. This picture shows a rectangle moving to the left and the ball hitting it during its movement, which results in a 90 degree angle. 
  ( Which shouldn't always be 90 ).</p>
  
  <p><img src="https://i.stack.imgur.com/rXv5w.png" alt=""></p>
  
  <p>Sorry about my crappy pictures i hope they make sense. My math is rusty thats why i really could need a push in the right direction.</p>