Alex Gardner <agardner...@gmail.com> wrote:
>
>When rect A collides with rect B they stick when I am wanting A to bounce off 
>of B.  I have tried different methods, but none seem to work.  My source is 
>here:  http://pastebin.com/CBYPcubL
>
>The collision code itself is below:
>------
># Bounce off of the paddle
>if paddle_rect.colliderect(ball_rect):
>    y_vel*=-1
>    x_vel*=-1

I haven't looked at the rest of your code, but the lines you have here are
going to send the ball back in exactly the direction it came from -- a 180
degree reversal.  When a ball hits a paddle at an angle other than head on,
only ONE of the velocities is reversed.  When you hit a horizontal paddle,
only the Y velocity is negated.  The ball continues in the same X
direction:

    \    O
     \  /
      \/
   ========

See?  The X velocity continues unchanged until it hits a vertical wall.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to