Computer Science Canada pong help |
Author: | LindenRulz [ Fri Feb 23, 2007 9:07 pm ] | ||
Post subject: | pong help | ||
I need help to detect if it hits the paddle or not and reflect if it does and quit if it doesn't. This is my code.
|
Author: | rollerdude [ Sat Feb 24, 2007 5:56 pm ] |
Post subject: | Re: pong help |
well, i haven't run it yet, but by looking at it, i see this line ballx < x - 51 and ballx > x + 51 if x=0 then ballx would have to be >51 and <-51 other than that, i seems allright maybe you meant ballx > x - 51 and ballx < x + 51 ?? hope i could help |
Author: | CodeMonkey2000 [ Sat Feb 24, 2007 8:12 pm ] |
Post subject: | RE:pong help |
You need to figure out the shortest distance between the mid-point of the ball and the top line of your paddle. If the distance is equal to or less than the radius of the ball then it has collided with your paddle and must now change direction, or else keep going. |